public ActionResult Delete(int id) { //Debug.WriteLine("update id is" + id); //we get the id of the update we want to delete from the database LiveWaitTime SelectedUpdate = db.LiveWaitTimes.Find(id); //we show it in our confirm page return(View(SelectedUpdate)); }
public ActionResult DeleteF(int id) { LiveWaitTime SelectedUpdate = db.LiveWaitTimes.Find(id); // once user confirms the delete the entry is removed from the database db.LiveWaitTimes.Remove(SelectedUpdate); db.SaveChanges(); //and they are redirected to the list of departments return(RedirectToAction("List")); }
public ActionResult Update(int id, DateTime WaitUpdateDate, DateTime WaitUpdateTime, int DepartmentId, int WaitTimeList) { //Debug.WriteLine("I want to edit a live wait time update time to " + WaitUpdateTime ); LiveWaitTime SelectedUpdate = db.LiveWaitTimes.Find(id); SelectedUpdate.WaitUpdateDate = WaitUpdateDate; SelectedUpdate.WaitUpdateTime = WaitUpdateTime; SelectedUpdate.DepartmentId = DepartmentId; SelectedUpdate.CurrentWaitTime = WaitTimeList; //once updated we save to the database db.SaveChanges(); //we redericet the admin to the list return(RedirectToAction("List")); }
public ActionResult Add(DateTime WaitUpdateDate, DateTime WaitUpdateTime, int DepartmentId, int WaitTimeList) { //Debug.WriteLine("Want to add an update with a department id of " + DepartmentId ) ; LiveWaitTime newUpdate = new LiveWaitTime(); newUpdate.WaitUpdateDate = WaitUpdateDate; newUpdate.WaitUpdateTime = WaitUpdateTime; newUpdate.DepartmentId = DepartmentId; newUpdate.CurrentWaitTime = WaitTimeList; //we insert all the data into the database db.LiveWaitTimes.Add(newUpdate); db.SaveChanges(); //once inserted we go back to the list return(RedirectToAction("List")); }