public bool InsertIngredient(SharedDataTypes.Ingredient i) { i.IngredientId = Guid.NewGuid(); //i.Modified = DateTime.Now(); mainDb.Ingredients.Add(converter.ConvertToDBIngredient(i)); return(mainDb.SaveChanges() == 1); }
public bool UpdateIngredient(SharedDataTypes.Ingredient i) { var temp = localDb.Ingredients.Where(p => p.ID_Ingredients == i.IngredientId).Select(j => j).First(); temp.Name = i.Name; temp.Description = i.Description; temp.Price = i.Price; temp.Availability = i.Available; temp.Type = i.Type; temp.UnitType = i.UnitType; temp.ModifyDate = DateTime.Now; return(localDb.SaveChanges() == 1); }
public DataBases.Ingredients ConvertToDBIngredient(SharedDataTypes.Ingredient i) { return(new DataBases.Ingredients { ID_Ingredients = i.IngredientId, Name = i.Name, Description = i.Description, Price = i.Price, Type = i.Type, UnitType = i.UnitType, Availability = i.Available, ModifyDate = DateTime.Now }); }
public bool InsertIngredient(SharedDataTypes.Ingredient i) { localDb.Ingredients.Add(converter.ConvertToDBIngredient(i)); return(localDb.SaveChanges() == 1); }