public static void AddSpecialInvent(SpecialInvent specialInvent) { using (restaurantEntities db = new restaurantEntities()) { db.SpecialInvent.Add(specialInvent); db.SaveChanges(); } }
//add public static void Add(Menu menu) { using (restaurantEntities db = new restaurantEntities()) { db.Menu.Add(menu); db.SaveChanges(); } }
//update public static void Update(EmployeesTypes employeesTypes) { using (restaurantEntities db = new restaurantEntities()) { db.Entry(employeesTypes).State = EntityState.Modified; db.SaveChanges(); } }
//add public static void Add(EmployeesTypes employeesTypes) { using (restaurantEntities db = new restaurantEntities()) { db.EmployeesTypes.Add(employeesTypes); db.SaveChanges(); } }
//delete public static void Delete(EmployeesTypes employeesTypes) { using (restaurantEntities db = new restaurantEntities()) { db.EmployeesTypes.Remove(employeesTypes); db.SaveChanges(); } }
//delete public static void Delete(StatusDose statusDose) { using (restaurantEntities db = new restaurantEntities()) { db.StatusDose.Remove(statusDose); db.SaveChanges(); } }
//delete public static void Delete(InventDose inventDose) { using (restaurantEntities db = new restaurantEntities()) { db.InventDose.Remove(inventDose); db.SaveChanges(); } }
//update public static void Update(Tables tables) { using (restaurantEntities db = new restaurantEntities()) { db.Entry(tables).State = EntityState.Modified; db.SaveChanges(); } }
//add public static void Add(CurrentEmployee currentEmployee) { using (restaurantEntities db = new restaurantEntities()) { db.CurrentEmployee.Add(currentEmployee); db.SaveChanges(); } }
//delete public static void Delete(CurrentEmployee currentEmployee) { using (restaurantEntities db = new restaurantEntities()) { db.CurrentEmployee.Remove(currentEmployee); db.SaveChanges(); } }
//add public static void Add(Tables tables) { using (restaurantEntities db = new restaurantEntities()) { db.Tables.Add(tables); db.SaveChanges(); } }
//add public static void Add(Rating Rating) { using (restaurantEntities db = new restaurantEntities()) { db.Rating.Add(Rating); db.SaveChanges(); } }
//delete public static void Delete(Rating Rating) { using (restaurantEntities db = new restaurantEntities()) { db.Rating.Remove(Rating); db.SaveChanges(); } }
// get by id // public static CommentVisiter GetById(int id) // { // using (restaurantEntities db = new restaurantEntities()) // { // return db.CommentVisiter.Find(id); // } // } // add public static void Add(CommentVisiter CommentVisiter) { using (restaurantEntities db = new restaurantEntities()) { db.CommentVisiter.Add(CommentVisiter); db.SaveChanges(); } }
//add public static void Add(StatusDose statusDose) { using (restaurantEntities db = new restaurantEntities()) { db.StatusDose.Add(statusDose); db.SaveChanges(); } }
//update public static void Update(CurrentEmployee currentEmployee) { using (restaurantEntities db = new restaurantEntities()) { db.Entry(currentEmployee).State = EntityState.Modified; db.SaveChanges(); } }
//delete public static void Delete(Tables tables) { using (restaurantEntities db = new restaurantEntities()) { db.Tables.Remove(tables); db.SaveChanges(); } }
public static void Update(InventDose inventDose) { using (restaurantEntities db = new restaurantEntities()) { db.Entry(inventDose).State = EntityState.Modified; db.SaveChanges(); } }
//add public static void Add(Category Category) { using (restaurantEntities db = new restaurantEntities()) { db.Category.Add(Category); db.SaveChanges(); } }
//delete public static void Delete(Visiters visiters) { using (restaurantEntities db = new restaurantEntities()) { db.Visiters.Remove(visiters); db.SaveChanges(); } }
public static void DeleteSpecialInvent(SpecialInvent specialInvent) { using (restaurantEntities db = new restaurantEntities()) { var o = db.SpecialInvent.Single(so => so.Id == specialInvent.Id); db.SpecialInvent.Remove(o); db.SaveChanges(); } }
//add public static Visiters Add(Visiters visiters) { using (restaurantEntities db = new restaurantEntities()) { visiters = db.Visiters.Add(visiters); db.SaveChanges(); return(visiters); } }
public static void UpdateSpecialInvent(SpecialInvent specialInvent) { using (restaurantEntities db = new restaurantEntities()) { var o = db.SpecialInvent.Single(so => so.Id == specialInvent.Id); o.isContact = true; 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(); } }
//delete public static void Delete(Menu menu) { using (restaurantEntities db = new restaurantEntities()) { var m = db.Menu.FirstOrDefault(p => p.Id == menu.Id); db.Menu.Remove(m); db.SaveChanges(); } }
//update public static void Update(Category Category) { using (restaurantEntities db = new restaurantEntities()) { var c = db.Category.FirstOrDefault(p => p.Id == Category.Id); c.nameCategory = Category.nameCategory; db.SaveChanges(); } }
//update public static void Update(Menu menu) { using (restaurantEntities db = new restaurantEntities()) { var m = db.Menu.FirstOrDefault(p => p.Id == menu.Id); m.NameDose = menu.NameDose; m.Price = menu.Price; m.InventDetails = menu.InventDetails; db.SaveChanges(); } }
public static int GetRate(int?doseId) { using (restaurantEntities db = new restaurantEntities()) { var d = db.Rating.Where(p => p.doseId == doseId).ToList(); var sum = d.Sum(p => p.rate); var cou = d.Count; var dos = db.Menu.First(p => p.Id == doseId); dos.RateDose = sum / cou; db.SaveChanges(); return((int)sum / cou); } }
//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(); } }
//delete public static void Delete(Category Category) { using (restaurantEntities db = new restaurantEntities()) { var m = db.Menu.Where(x => x.Category == Category.Id).ToList(); if (m != null) { foreach (var item in m) { db.Menu.Remove(item); } } var c = db.Category.FirstOrDefault(C => C.Id == Category.Id); db.Category.Remove(c); db.SaveChanges(); } }