public ActionResult DeleteConfirmed(int id) { Barbershop barbershop = db.Barbershops.Find(id); db.Barbershops.Remove(barbershop); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Name")] Barbershop barbershop) { if (ModelState.IsValid) { db.Entry(barbershop).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(barbershop)); }
public ActionResult Create([Bind(Include = "Id,Name")] Barbershop barbershop) { if (ModelState.IsValid) { db.Barbershops.Add(barbershop); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(barbershop)); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Barbershop barbershop = db.Barbershops.Find(id); if (barbershop == null) { return(HttpNotFound()); } return(View(barbershop)); }
static void Main(string[] args) { var context = new Barbershop(); }