public static IValidationResult Validate(this Location location) { var result = new DictionaryValidationResult(); if (location.Id == Guid.Empty) { result.AddError(V.Location_Id, V.Location_Id_Invalid); } if (!ValidationUtils.IsValidString(location.Name, 200, true)) { result.AddError(V.Location_Name, V.Location_Name_Invalid); } if (location.Latitude < -90 || location.Latitude > 90) { result.AddError(V.Location_Latitude, V.Location_Latitude_Invalid); } if (location.Longitude < -180 || location.Longitude > 180) { result.AddError(V.Location_Longitude, V.Location_Longitude_Invalid); } return(result); }
public static IValidationResult Validate(this ClothingItemImage clothingItemImage) { var result = new DictionaryValidationResult(); if (clothingItemImage.ClothingItemId == Guid.Empty) { result.AddError(V.ClothingItemImage_ClothingItemId, V.ClothingItemImage_ClothingItemId_Empty); } if (clothingItemImage.ImageId == Guid.Empty) { result.AddError(V.ClothingItemImage_ImageId, V.ClothingItemImage_ImageId_Empty); } return(result); }
public static IValidationResult Validate(this Image image) { var result = new DictionaryValidationResult(); if (image.Id == Guid.Empty) { result.AddError(V.Image_Id, V.Image_Id_Invalid); } if (!ValidationUtils.IsValidString(image.Name, 200, true)) { result.AddError(V.Image_Name, V.Image_Name_Invalid); } if (image.ImageFile == null || image.ImageFile.Length == 0) { result.AddError(V.Image_ImageFile, V.Image_ImageFile_Invalid); } return(result); }
public static IValidationResult Validate(this ClothingItem clothingItem) { var result = new DictionaryValidationResult(); if (clothingItem.Id == Guid.Empty) { result.AddError(V.ClothingItem_Id, V.ClothingItem_Id_Empty); } if (!ValidationUtils.IsValidString(clothingItem.Type, 200, true)) { result.AddError(V.ClothingItem_Type, V.ClothingItem_Type_Invalid); } if (!ValidationUtils.IsValidString(clothingItem.Size, 200, true)) { result.AddError(V.ClothingItem_Size, V.ClothingItem_Size_Invalid); } if (!ValidationUtils.IsValidString(clothingItem.PurchaseLocation, 200, true)) { result.AddError(V.ClothingItem_PurchaseLocation, V.ClothingItem_PurchaseLocation_Invalid); } if (!ValidationUtils.IsValidString(clothingItem.Currency, 50, true)) { result.AddError(V.ClothingItem_Currency, V.ClothingItem_Currency_Invalid); } if (!ValidationUtils.IsValidString(clothingItem.Comments, 200, true)) { result.AddError(V.ClothingItem_Comments, V.ClothingItem_Comments_Invalid); } return(result); }