public IActionResult Create(RoutingViewModel routing) { if (ModelState.IsValid) { _repository.Add(Mapper.Map <Routing>(routing)); return(RedirectToAction("Index")); } return(View(routing)); }
public IActionResult Edit(RoutingViewModel routing) { //Only Id is set via the page, so get the value alongside the id routing.Source = _repository.GetOneBusinessProcess(p => p.Id == routing.Source.Id); routing.Destination = _repository.GetOneBusinessProcess(p => p.Id == routing.Destination.Id); if (ModelState.IsValid) { _repository.Update(Mapper.Map <Routing>(routing)); return(RedirectToAction("Index")); } return(View(routing)); }
// GET: Routing/Details/5 public IActionResult Details(int?id) { if (id == null) { return(HttpNotFound()); } RoutingViewModel routing = Mapper.Map <RoutingViewModel>(_repository.GetOneRouting(m => m.Id == id)); if (routing == null) { return(HttpNotFound()); } return(View(routing)); }
// GET: Routing/Edit/5 public IActionResult Edit(int?id) { if (id == null) { return(HttpNotFound()); } RoutingViewModel routing = Mapper.Map <RoutingViewModel>(_repository.GetOneRouting(m => m.Id == id)); if (routing == null) { return(HttpNotFound()); } ViewBag.BusinessProcessSelection = new SelectList(_repository.GetAllBusinessProcesses(bp => true).Select(b => new SelectListItem { Value = b.Id.ToString(), Text = b.ToString() }), "Value", "Text"); return(View(routing)); }