//Update Ingredients public Boolean UpdateIngredients(Ingredient I)//Ingredients Object, LastUpdateBy { INGREDIENT result = (from p in db.INGREDIENT where p.ID == I.IID select p).SingleOrDefault(); result.PRICE = I.Price; result.FILENAME = I.Filename; result.MIMETYPE = I.MIMETYPE; result.INGREDIENT_IMAGE = I.Ingredient_Image; result.DESCRIPTION = I.Description; result.LOCATION_TOP = I.Location_Top; result.LOCATION_BOTTOM = I.Location_Bottom; result.LOCATION_CHOC = I.Location_Choc; result.CATEGORY_ID = I.CategoryId; result.NAME = I.Name; result.QUANTITY = I.Quantity; result.IMAGE_LAST_UPDATE = I.Image_Last_Update; result.FRONTEND_ID = I.FrontendID; result.MANUFACTURER_ID = I.ManufacturerID; try { db.SaveChanges(); return(true); } catch (DbUpdateException ex) { return(false); } }
public Boolean UpdateIngredientsMID(decimal iid, decimal?mid, string lub) //IngredientID, ManufacturerID, LastUpdateBy { INGREDIENT result = (from p in db.INGREDIENT where p.ID == iid select p).SingleOrDefault(); result.MANUFACTURER_ID = mid; result.LAST_UPDATED_BY = lub; try { db.SaveChanges(); return(true); } catch (DbUpdateException ex) { return(false); } }
public void AddIngredient(Ingredient I) { INGREDIENT it = new INGREDIENT(); it.ID = I.IID; it.PRICE = I.Price; it.FILENAME = I.Filename; it.MIMETYPE = I.MIMETYPE; it.INGREDIENT_IMAGE = I.Ingredient_Image; it.DESCRIPTION = I.Description; it.LOCATION_TOP = I.Location_Top; it.LOCATION_BOTTOM = I.Location_Bottom; it.LOCATION_CHOC = I.Location_Choc; it.CATEGORY_ID = I.CategoryId; it.NAME = I.Name; it.QUANTITY = I.Quantity; it.IMAGE_LAST_UPDATE = I.Image_Last_Update; it.FRONTEND_ID = I.FrontendID; it.MANUFACTURER_ID = I.ManufacturerID; db.INGREDIENT.Add(it); db.SaveChanges(); }