public ActionResult DeleteConfirmed(int id) { Holiday holiday = db.Holidays.Find(id); db.Holidays.Remove(holiday); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Name,Date")] Holiday holiday) { if (ModelState.IsValid) { db.Entry(holiday).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(holiday)); }
public ActionResult Create([Bind(Include = "Id,Name,Date")] Holiday holiday) { if (ModelState.IsValid) { db.Holidays.Add(holiday); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(holiday)); }
// GET: Holidays/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Holiday holiday = db.Holidays.Find(id); if (holiday == null) { return(HttpNotFound()); } return(View(holiday)); }