Ejemplo n.º 1
0
 public void Update(IngredientDetailModel model)
 {
     using (var dbContext = dbContextFactory.CreateDbContext())
     {
         var entity = IngredientMapper.MapIngredientDetailModelToEntity(model);
         dbContext.Ingredients.Update(entity);
         dbContext.SaveChanges();
     }
 }
Ejemplo n.º 2
0
 public IngredientDetailModel Create(IngredientDetailModel model)
 {
     using (var dbContext = dbContextFactory.CreateDbContext())
     {
         var entity = IngredientMapper.MapIngredientDetailModelToEntity(model);
         dbContext.Ingredients.Add(entity);
         dbContext.SaveChanges();
         return(IngredientMapper.MapIngredientEntityToDetailModel(entity));
     }
 }
Ejemplo n.º 3
0
        public IngredientDetailModel InsertOrUpdate(IngredientDetailModel model)
        {
            using var dbContext = _dbContextFactory.Create();

            var entity = IngredientMapper.MapIngredientDetailModelToEntity(model);

            dbContext.Ingredients.Update(entity);
            dbContext.SaveChanges();

            return(IngredientMapper.MapIngredientEntityToDetailModel(entity));
        }