Esempio n. 1
0
 public SuccessResponse Update(IngredientGroupRequest request)
 {
     try
     {
         var currentIngredientGroup = _ingredientGroupRepository.FindBy(request.Id);
         currentIngredientGroup.ThrowExceptionIfRecordIsNull();
         var ingredientGroupToCopy = TypeAdapter.Adapt <IngredientGroup>(request);
         TypeAdapter.Adapt(ingredientGroupToCopy, currentIngredientGroup);
         _ingredientGroupValidator.ValidateAndThrowException(currentIngredientGroup, "Base");
         _ingredientGroupRepository.Update(currentIngredientGroup);
         return(new SuccessResponse {
             IsSuccess = true
         });
     }
     catch (DataAccessException)
     {
         throw new ApplicationException();
     }
 }