public IngredientBO Create(IngredientBO ind) { using (var uow = facade.UnitOfWork) { var newInd = uow.IngredientRepository.Create(Iconv.Convert(ind)); uow.Complete(); return(Iconv.Convert(newInd)); } }
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)); } }
public IngredientBO Post([FromBody] IngredientBO ind) { return(facade.IngredientService.Create(ind)); }
public IngredientBO Put(int id, [FromBody] IngredientBO ind) { return(facade.IngredientService.Update(ind)); }