public ActionResult Create() { var viewModel = new AreaOfInterestViewModel { AreaOfInterest = new AreaOfInterest() { OrganisationId = UserOrganisationId, }, }; return(View(viewModel)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var areaOfInterest = NidanBusinessService.RetrieveAreaOfInterest(UserOrganisationId, id.Value); AreaOfInterestName = areaOfInterest.Name; var viewmodel = new AreaOfInterestViewModel() { AreaOfInterest = areaOfInterest, }; return(View(viewmodel)); }
public ActionResult Edit(AreaOfInterestViewModel areaOfInterestViewModel) { if (ModelState.IsValid) { areaOfInterestViewModel.AreaOfInterest.OrganisationId = UserOrganisationId; var result = NidanBusinessService.UpdateAreaOfInterest(UserOrganisationId, areaOfInterestViewModel.AreaOfInterest); if (result.Succeeded) { return(RedirectToAction("Index")); } foreach (var error in result.Errors) { ModelState.AddModelError("", error); } return(RedirectToAction("Index")); } return(View(areaOfInterestViewModel)); }