public ActionResult Edit(VehicleTransmissionList model) { SetActiveMenuItem(); if (!ModelState.IsValid) { return(View(model)); } try { //Set our updater name var FullName = Request.Cookies["userInfo"]["FullName"]; //Now update the record TransmissionTypeBLL.UpdateTransmissionType(model, FullName); //Take our ID with us to the confirmation form ViewBag.Id = model.Id; //Determine the kind of SQL transaction we have performed ViewBag.Message = "updated"; //We can now safely go to the confirmation view return(View("AddUpdateConfirm")); } catch (Exception ex) { TempData["ErrorMessage"] = ex.Message; return(Redirect("~/Admin/Home/Error")); } }
public ActionResult Create(VehicleTransmissionList model) { if (!ModelState.IsValid) { return(View(model)); } try { //Set our initial return value var returnValue = 0; //Set our updater name var FullName = Request.Cookies["userInfo"]["FullName"]; //Attempt to add our record TransmissionTypeBLL.AddTransmissionType(model, FullName, out returnValue); //Take our ID with us to the confirmation form ViewBag.Id = returnValue; //Determine the kind of SQL transaction we have performed ViewBag.Message = "added"; //We can now safely go to the confirmation view return(View("AddUpdateConfirm")); } catch (Exception ex) { TempData["ErrorMessage"] = ex.Message; return(Redirect("~/Admin/Home/Error")); } }
// GET: /Admin/TransmissionType/Edit public ActionResult Edit(int id) { SetActiveMenuItem(); try { var model = TransmissionTypeBLL.GetTransmissionType(id); return(View(model: model)); } catch (Exception ex) { TempData["ErrorMessage"] = ex.Message; return(Redirect("~/Admin/Home/Error")); } }