public ActionResult DeleteConfirmed(int id) { CommonPlaceModel commonPlaceModel = db.CommonPlaceModels.Find(id); db.CommonPlaceModels.Remove(commonPlaceModel); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,Name,Price,Capacity,IncludeItens,Active,Terms")] CommonPlaceModel commonPlaceModel) { if (ModelState.IsValid) { db.Entry(commonPlaceModel).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(commonPlaceModel)); }
// GET: CommonPlace/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CommonPlaceModel commonPlaceModel = db.CommonPlaceModels.Find(id); if (commonPlaceModel == null) { return(HttpNotFound()); } return(View(commonPlaceModel)); }
public ActionResult Create([Bind(Include = "ID,Name,Price,Capacity,IncludeItens,Active,Terms")] CommonPlaceModel commonPlaceModel) { if (ModelState.IsValid) { var user = db.Users.Find(User.Identity.GetUserId()); var condo = db.CondoModels.FirstOrDefault(x => x.ID == user.Condo_ID); commonPlaceModel.Condo = condo; db.CommonPlaceModels.Add(commonPlaceModel); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(commonPlaceModel)); }