public string ShortSummary() { string result; string province = ""; if (!String.IsNullOrEmpty(ProvinceCode)) { province = ModelValidations.Capitilize(ProvinceCodeNavigation.EnglishName); } result = Street + ", " + PostalCode + ", " + ModelValidations.Capitilize(CountryCodeNavigation.EnglishName) + ", " + province; //<b> + street etc return(result); }
public string Summary() { string result; string province = ""; if (!String.IsNullOrEmpty(ProvinceCode)) { province = "<br/> <b>Province</b> <br/> " + ModelValidations.Capitilize(ProvinceCodeNavigation.EnglishName); } result = "<b> Street </b> <br/>" + Street + "<br/> <b>City</b> <br/>" + City + " <br/> <b>Postal Code</b> <br/>" + PostalCode + " <br/> <b>Country</b> <br/>" + ModelValidations.Capitilize(CountryCodeNavigation.EnglishName) + " " + province; //<b> + street etc return(result); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { //Title (must not be blank) if (EnglishName == null || EnglishName.Trim() == "") { yield return(new ValidationResult("English Name cannot be blank.", new[] { nameof(EnglishName) })); } else { EnglishName = EnglishName.Trim(); } //Price if (Price == null) { yield return(new ValidationResult("Price can not be blank.", new[] { nameof(Price) })); } else if (Price < 0) { yield return(new ValidationResult("Price can not be less than 0.", new[] { nameof(Price) })); } //Player Count (must not be blank and be a number) if (EnglishPlayerCount == null || EnglishPlayerCount.Trim() == "") { yield return(new ValidationResult("Player Count cannot be blank.", new[] { nameof(EnglishPlayerCount) })); } else if (ModelValidations.IsStringNumeric(EnglishPlayerCount)) { EnglishPlayerCount = EnglishPlayerCount.Trim(); } //Category is an int, does not need to be validated. //Perspective Code (must not be blank) if (GamePerspectiveCode == null || GamePerspectiveCode.Trim() == "") { yield return(new ValidationResult("Perspective Code cannot be blank.", new[] { nameof(GamePerspectiveCode) })); } else { GamePerspectiveCode = GamePerspectiveCode.Trim(); } //Status Code (must not be blank) if (GameFormatCode == null || GameFormatCode.Trim() == "") { yield return(new ValidationResult("Status Code cannot be blank.", new[] { nameof(GameFormatCode) })); } else { GameFormatCode = GameFormatCode.Trim(); } //Subcategory is an int, does not need to be validated. //Description (must not be blank) if (EnglishDescription == null || EnglishDescription.Trim() == "") { yield return(new ValidationResult("Description cannot be blank.", new[] { nameof(EnglishDescription) })); } else { EnglishDescription = EnglishDescription.Trim(); } //Status Code (must not be blank) if (EnglishDetail == null || EnglishDetail.Trim() == "") { yield return(new ValidationResult("Detail cannot be blank.", new[] { nameof(EnglishDetail) })); } else { EnglishDetail = EnglishDetail.Trim(); } yield return(ValidationResult.Success); }