public void AddRecipe(Recipe r) { RECIEPE rt = new RECIEPE(); rt.ID = r.RID; rt.PRODUCT_ID = r.ProductID; rt.DESCRIPTION = r.Description; rt.FRONTEND_ID = r.FrontendID; rt.MANUFACTURER_ID = r.ManufacturerID; rt.LAST_UPDATED_BY = r.Last_Updated_By; rt.LAST_MODIFIED_DATE = r.Last_Updated; db.RECIEPE.Add(rt); db.SaveChanges(); }
public Boolean UpdateRecipeMID(decimal rid, decimal?mid, string lub) //RecipeID, ManufacturerID, LastUpdateBy { RECIEPE result = (from p in db.RECIEPE where p.ID == rid select p).SingleOrDefault(); result.MANUFACTURER_ID = rid; result.LAST_UPDATED_BY = lub; try { db.SaveChanges(); return(true); } catch (DbUpdateException ex) { return(false); } }
//Update Recipe public Boolean UpdateRecipe(Recipe R, string lub)//Recipe Object, LastUpdateBy { RECIEPE result = (from p in db.RECIEPE where p.ID == R.RID select p).SingleOrDefault(); result.PRODUCT_ID = R.ProductID; result.DESCRIPTION = R.Description; result.FRONTEND_ID = R.FrontendID; result.MANUFACTURER_ID = R.ManufacturerID; result.LAST_UPDATED_BY = lub; try { db.SaveChanges(); return(true); } catch (DbUpdateException ex) { return(false); } }