public ActionResult Appointment(BookAppoitment model) { try { BookAppoitment appoitment = new BookAppoitment(); appoitment.Name = model.Name; appoitment.Number = model.Number; appoitment.Email = model.Email; appoitment.Date = model.Date; appoitment.Note = model.Note; _context.BookAppoitments.Add(appoitment); _context.SaveChanges(); int LatestAppointmentId = appoitment.Id; } catch (Exception) { throw; } return(RedirectToAction("index")); }
// GET: Admin/BookAppoitments/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BookAppoitment bookAppoitment = db.BookAppoitments.Find(id); if (bookAppoitment == null) { return(HttpNotFound()); } db.BookAppoitments.Remove(bookAppoitment); db.SaveChanges(); return(RedirectToAction("Index")); }