public ActionResult Create() { OperationCreateEdit op = new OperationCreateEdit() { ItemsList = GetItemsList() }; return(View(op)); }
public ActionResult Edit(int id) { var operation = operationCRUD.Operations.FirstOrDefault(x => x.ID == id); if (operation != null) { OperationCreateEdit op = new OperationCreateEdit() { Operation = mapper.Mapping(operation), ItemsList = GetItemsList() }; return(View(op)); } else { return(View()); } }
public ActionResult Edit(int id, Operation operation) { if (ModelState.IsValid == true) { try { operationCRUD.EditOperation(mapper.Mapping(operation)); return(RedirectToAction("Index")); } catch (Exception e) { ViewBag.ErrorMessage = new ErrorMessage().Get(e); return(View("Error")); } } else { OperationCreateEdit op = new OperationCreateEdit() { ItemsList = GetItemsList() }; return(View(op)); } }