/// <summary> /// Save the amount to the database. /// </summary> /// <param name="amount">The amount that will be saved.</param> public void SaveAmount(Amount amount) { ICollection <ValidationResult> validationResults; if (!amount.Validate(out validationResults)) { var ex = new ValidationException(Validation_Object_Error); ex.Data.Add("ValidationResult", validationResults); throw ex; } if (amount.AmountID == 0) { AmountDAL.InsertAmount(amount); } else { AmountDAL.UpdateAmount(amount); } }
/// <summary> /// Removes the specified amount from the database. /// </summary> /// <param name="amountId">The amount to be deleted.</param> public void DeleteAmount(int amountId) { AmountDAL.DeleteAmount(amountId); }
/// <summary> /// Retrieving a amount entry depending on the recipeId provided. /// </summary> /// <param name="recipeId"></param> /// <returns>A list containing the amount</returns> public List <Amount> GetAmountByRecipeId(int recipeId) { return(AmountDAL.GetAmountByRecipeId(recipeId)); }
public Amount GetAmountByIngredientId(int ingredientId) { return(AmountDAL.GetAmountByIngredientId(ingredientId)); }
/// <summary> /// Retrieving a amount entry with a specific amount number from the database. /// </summary> /// <param name="amountId">The Amount's Number.</param> /// <returns>A Amount-object containing the amount.</returns> public Amount GetAmount(int amountId) { return(AmountDAL.GetAmountById(amountId)); }