// // GET: /MasterItems/OganisationType/Edit/5 public ActionResult Edit(int id = 0) { try { sw.OrganisationType organisationtype = swdb.OrganisationType.Single(o => o.Id == id); if (organisationtype == null) { return(HttpNotFound()); } return(View(organisationtype)); } catch (Exception ex) { // Log with Elmah TempData["message"] = Settings.Default.GenericExceptionMessage; return(RedirectToAction("Index", "Home", new { area = "Admin" })); } }
public ActionResult Create(sw.OrganisationType organisationtype) { try { if (ModelState.IsValid) { organisationtype.ModifiedBy = User.Identity.Name; organisationtype.ModifiedDate = DateTime.Now; swdb.OrganisationType.Add(organisationtype); swdb.SaveChanges(); TempData["message"] = "<b>" + organisationtype.Name + "</b> was Successfully Created"; return(RedirectToAction("Index")); } return(View(organisationtype)); } catch (Exception ex) { // Log with Elmah TempData["message"] = Settings.Default.GenericExceptionMessage; return(RedirectToAction("Index", "Home", new { area = "Admin" })); } }