// // GET: /Application/Create public ActionResult Create() { var viewmodel = new ApplicationCreateViewModel(); viewmodel.ApplicationContacts = null; viewmodel.ApplicationDocuments = null; 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); }
public ActionResult Create(ApplicationCreateViewModel applicationCreateViewModel) { if (ModelState.IsValid) { Application application = applicationCreateViewModel.Application; application.BusinessCriticalityId = applicationCreateViewModel.BusinessCriticalitySelectedValue; application.ServiceAreaId = applicationCreateViewModel.ServiceAreaSelectedValue; var result = AppRepo.CreateApplication(application); if (result == "Success") { 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(applicationCreateViewModel); }