public ActionResult DeleteConfirmed(Guid id) { OwnModel ownModel = db.Owns.Find(id); db.Owns.Remove(ownModel); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(OwnModel ownModel) { if (ModelState.IsValid) { ownModel.Id = Guid.NewGuid(); db.Owns.Add(ownModel); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(ownModel)); }
// GET: Own/Edit/5 public ActionResult Edit(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OwnModel ownModel = db.Owns.Find(id); if (ownModel == null) { return(HttpNotFound()); } return(View(ownModel)); }
public ActionResult Edit(FormCollection form) { OwnModel ownModel = new OwnModel(); if (!TryUpdateModel <OwnModel>(ownModel)) { return(View()); } if (ModelState.IsValid) { db.Entry(ownModel).State = EntityState.Modified; //db.SaveChanges(); //return RedirectToAction("Index"); } if (form["btn1"] != null) { return(View()); } else if (form["btn2"] != null) { return(View()); } return(View()); }