コード例 #1
0
        public ActionResult Create()
        {
            var viewModel = new AreaOfInterestViewModel
            {
                AreaOfInterest = new AreaOfInterest()
                {
                    OrganisationId = UserOrganisationId,
                },
            };

            return(View(viewModel));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 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));
 }