public ValidationHelper(ref ValidationResult_OSC result, ModelStateDictionary ModelState) { if (!ModelState.IsValid) { foreach (var value in ModelState.Values) { foreach (var err in value.Errors) { result.AddMessage(err.ErrorMessage); } } } }
public ValidationResult_OSC PostProductImageInfo([FromBody] List<OnlineShoppingCart.Model.ProductImageInfo> lstProductImageInfo) { var result = new ValidationResult_OSC(); //validate that string path is not empty bool listNotValid = lstProductImageInfo.Any(cus => String.IsNullOrWhiteSpace(cus.ImageFilePath)); if (listNotValid) { result.AddMessage("One or more image path are empty."); return result; } ProductImage productImageDAL = new ProductImage(); result = productImageDAL.AddListProductImageFilePath(lstProductImageInfo); return result; }