示例#1
0
 public ActionResult AddWoreda(int id)
 {
     //var donorCoverage = _hrdDonorCoverageService.FindById(id);
     ViewBag.RegionID = new SelectList(_adminUnitService.GetRegions(), "AdminUnitID", "Name");
     ViewBag.ZoneID = new SelectList(_adminUnitService.FindBy(m=>m.AdminUnitTypeID==3), "AdminUnitID", "Name");
     ViewBag.WoredaID = new SelectList(_adminUnitService.FindBy(m => m.AdminUnitTypeID == 4), "AdminUnitID", "Name");
     var addWoredaViewModel = new AddWoredaViewModel();
     addWoredaViewModel.DonorCoverageID = id;
     return PartialView(addWoredaViewModel);
 }
示例#2
0
        public ActionResult AddWoreda(AddWoredaViewModel addWoredaViewModel)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var donorCoverageDetail = GetCoverageDetail(addWoredaViewModel);
                    _hrdDonorCoverageDetailService.AddWoredas(donorCoverageDetail);
                    return RedirectToAction("Detail", new { id = addWoredaViewModel.DonorCoverageID });
                }
                catch (Exception e)
                {

                    ModelState.AddModelError("Errors",@"Unable to Add Woreda");
                }
            }
            return RedirectToAction("Detail", new { id = addWoredaViewModel.DonorCoverageID });
        }
示例#3
0
 private HrdDonorCoverageDetail GetCoverageDetail(AddWoredaViewModel addWoredaViewModel)
 {
     var hrdDonorCoverageDetail = new HrdDonorCoverageDetail()
         {
             HRDDonorCoverageID = addWoredaViewModel.DonorCoverageID,
             WoredaID = addWoredaViewModel.WoredaID
         };
     return hrdDonorCoverageDetail;
 }