public ActionResult Create(LocationExperience exp) { exp.Name = User.Identity.Name; if (ModelState.IsValid) { _db.LocationExperiences.Add(exp); _db.SaveChanges(); return RedirectToAction("Index", new { id = exp.LocationID }); } return View(exp); }
public ActionResult Edit(LocationExperience exp) { if (User.Identity.Name == exp.Name) { if (ModelState.IsValid) { _db.Entry(exp).State = EntityState.Modified; _db.SaveChanges(); return RedirectToAction("Index", new { id = exp.LocationID }); } } return View(exp); }