public ActionResult Edit(Location item) { try { if (User.IsInRole("Admin")) { if (ModelState.IsValid) { if (item.LocationId > 0) { var updatedRecord = _repo.Update(item); if (updatedRecord.LocationId < 1) { return(RedirectToAction("Error404", "Home")); } return(RedirectToAction("Index", "Locations")); } } } return(RedirectToAction("Login", "Account")); } catch (Exception ex) { return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, ex.ToString())); } }
public void Put([FromBody] Location location) { _repo.Update(location); }