Beispiel #1
0
 public IngredientBO Create(IngredientBO ind)
 {
     using (var uow = facade.UnitOfWork)
     {
         var newInd = uow.IngredientRepository.Create(Iconv.Convert(ind));
         uow.Complete();
         return(Iconv.Convert(newInd));
     }
 }
Beispiel #2
0
        public IngredientBO Update(IngredientBO ind)
        {
            using (var uow = facade.UnitOfWork)
            {
                var IngredientFromDb = uow.IngredientRepository.Get(ind.Id);
                if (IngredientFromDb == null)
                {
                    throw new InvalidOperationException("Product not found");
                }
                IngredientFromDb.Id   = ind.Id;
                IngredientFromDb.Name = ind.Name;


                uow.Complete();
                return(Iconv.Convert(IngredientFromDb));
            }
        }
Beispiel #3
0
 public IngredientBO Post([FromBody] IngredientBO ind)
 {
     return(facade.IngredientService.Create(ind));
 }
Beispiel #4
0
 public IngredientBO Put(int id, [FromBody] IngredientBO ind)
 {
     return(facade.IngredientService.Update(ind));
 }