added additional validation to add/edit portfolio

This commit is contained in:
Matthew D. Groves 2010-12-18 13:45:57 -06:00
parent 1e7dde035b
commit 7eb5623d25

View file

@ -68,6 +68,7 @@ namespace MonoStockPortfolio
private bool Validate(Portfolio portfolioToSave) private bool Validate(Portfolio portfolioToSave)
{ {
var validator = new FormValidator(); var validator = new FormValidator();
validator.AddRequired(PortfolioName, "Please enter a portfolio name");
validator.AddValidation(PortfolioName, () => IsDuplicateName(portfolioToSave)); validator.AddValidation(PortfolioName, () => IsDuplicateName(portfolioToSave));
var result = validator.Apply(); var result = validator.Apply();