public static void Update(InventDose inventDose) { using (restaurantEntities db = new restaurantEntities()) { db.Entry(inventDose).State = EntityState.Modified; db.SaveChanges(); } }
//delete public static void Delete(InventDose inventDose) { using (restaurantEntities db = new restaurantEntities()) { db.InventDose.Remove(inventDose); db.SaveChanges(); } }
public static void Addfeedback(InventDose inventDose) { using (restaurantEntities db = new restaurantEntities()) { var dose = db.InventDose.FirstOrDefault(d => d.Id == inventDose.Id); dose.Feedback = inventDose.Feedback; db.SaveChanges(); } }
//update public static void UpdateIdStatus(InventDose inventDose) { using (restaurantEntities db = new restaurantEntities()) { var dose = db.InventDose.FirstOrDefault(d => d.Id == inventDose.Id); if (dose.IdStatusDose == 3) { dose.IdStatusDose = 1; } else { dose.IdStatusDose = 2; } db.SaveChanges(); } }
//add public static InventDose Add(InventDose inventDose) { using (restaurantEntities db = new restaurantEntities()) { inventDose.DateInvent = DateTime.Now; var inventDose1 = db.InventDose.Add(inventDose); db.SaveChanges(); //foreach (var item in inventDose.InventDetails) //{ // item.InventDose = null; // item.IdDose = inventDose1.Id; // db.InventDetails.Add(item); // db.SaveChanges(); //} //db.InventDetails.AddRange(db.InventDetails); return(inventDose); } }