public ActionResult Edit(ApplicationEditViewModel applicationViewModel) { if (ModelState.IsValid) { Application application = applicationViewModel.Application; application.BusinessCriticalityId = applicationViewModel.BusinessCriticalitySelectedValue; application.ServiceAreaId = applicationViewModel.ServiceAreaSelectedValue; AppRepo.EditApplication(application); return RedirectToAction("Index"); } ViewBag.BusinessCriticalityId = new SelectList(BusCritRepo.GetAllBusinessCriticalities(), "BusinessCriticalityId", "Name"); ViewBag.BusinessContact = new SelectList(ContactRepo.GetAllContacts(), "ContactId", "ContactId"); ViewBag.IctContact = new SelectList(ContactRepo.GetAllContacts(), "ContactId", "ContactId"); ViewBag.ServiceAreaId = new SelectList(ServiceAreaRepo.GetAllServiceAreas(), "ServiceAreaId", "Name"); return View(applicationViewModel); }
// // GET: /Application/Edit/5 public ActionResult Edit(Guid id) { Application application = AppRepo.GetApplication(id); if (application == null) { return HttpNotFound(); } var viewmodel = new ApplicationEditViewModel(); viewmodel.Application = application; viewmodel.BusinessCriticalitySelectedValue = application.BusinessCriticalityId; viewmodel.ServiceAreaSelectedValue = application.ServiceAreaId; viewmodel.ApplicationContacts = AppRepo.GetApplicationContacts(id); viewmodel.ApplicationDocuments = AppRepo.GetApplicationDocuments(id); viewmodel.BusinessCriticalities = BusCritRepo.GetAllBusinessCriticalities(); viewmodel.ServiceAreas = ServiceAreaRepo.GetAllServiceAreas(); ViewBag.BusinessCriticalityId = new SelectList(BusCritRepo.GetAllBusinessCriticalities(), "BusinessCriticalityId", "Name"); ViewBag.BusinessContact = new SelectList(ContactRepo.GetAllContacts(), "ContactId", "ContactId"); ViewBag.IctContact = new SelectList(ContactRepo.GetAllContacts(), "ContactId", "ContactId"); ViewBag.ServiceAreaId = new SelectList(ServiceAreaRepo.GetAllServiceAreas(), "ServiceAreaId", "Name"); return View(viewmodel); }