public ActionResult Create(PropertyOwnerRepresentative propertyownerrepresentative) { if (ModelState.IsValid) { db.PropertyOwnerRepresentatives.Add(propertyownerrepresentative); db.SaveChanges(); return RedirectToAction("Edit", new { id = propertyownerrepresentative.PropertyOwnerRepresentativeID }); } return View(propertyownerrepresentative); }
public ActionResult Edit(PropertyOwnerRepresentative propertyownerrepresentative) { if (ModelState.IsValid) { using (var _db = new PortugalVillasContext()) { _db.PropertyOwnerRepresentatives.Attach(propertyownerrepresentative); _db.Entry(propertyownerrepresentative).State = EntityState.Modified; _db.SaveChanges(); return RedirectToAction("Edit", new {id = propertyownerrepresentative.PropertyOwnerRepresentativeID}); } } return View(propertyownerrepresentative); }