Exemplo n.º 1
0
 public ActionResult DeleteRegion(RegionViewModel viewModel)
 {
     RegionOperationService service = new RegionOperationService(regionRepository,
         viewModel.CityName, viewModel.DistrictName, viewModel.RegionName);
     bool result = service.DeleteOneRegion();
     if (result)
     {
         TempData["success"] = viewModel.DeleteRegionSuccessMessage;
     }
     else
     {
         TempData["error"] = viewModel.DeleteRegionFailMessage;
     }
     return RedirectToAction("Region");
 }
 public bool TestDeleteRegion(int cityId, int districtId, int regionId)
 {
     service = new RegionOperationService(repository,
         "C-" + cityId, "D-" + districtId, "R-" + regionId);
     return service.DeleteOneRegion();
 }
Exemplo n.º 3
0
 public ActionResult ModifyRegion(RegionViewModel viewModel)
 {
     RegionOperationService service = new RegionOperationService(regionRepository,
         viewModel.CityName, viewModel.DistrictName, viewModel.RegionName);
     bool result = service.SaveOneRegion(viewModel.ForceSwapRegionDistricts);
     if (result)
     {
         TempData["success"] = viewModel.SaveRegionSuccessMessage;
     }
     else
     {
         TempData["error"] = viewModel.SaveRegionFailMessage;
     }
     TempData["RegionViewModel"] = new RegionViewModel("modifyRegion")
     {
         CityName = viewModel.CityName,
         DistrictName = viewModel.DistrictName,
         TownName = viewModel.TownName,
         RegionName = viewModel.RegionName
     };
     return RedirectToAction("Region");
 }
 public bool TestAddRegionForce(int cityId, int districtId, int regionId)
 {
     service = new RegionOperationService(repository,
         "C-" + cityId, "D-" + districtId, "R-" + regionId);
     return service.SaveOneRegion(true);
 }