Example #1
0
 public ActionResult AddWoreda(int id)
 {
     var hrd = _hrdService.FindById(id);
      if (hrd==null)
      {
      return HttpNotFound();
      }
      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 HrdAddWoredaViewModel();
      addWoredaViewModel.HRDID = id;
      addWoredaViewModel.StartingMonth = hrd.Plan.StartDate.Month;
      return PartialView(addWoredaViewModel);
 }
Example #2
0
        public ActionResult AddWoreda(HrdAddWoredaViewModel addWoredaViewModel)
        {
            if (ModelState.IsValid)
            {
            try
            {
                var detail = GetDetail(addWoredaViewModel);

                if(_hrdDetailService.AddWoreda(detail))
                return RedirectToAction("HRDDetail", new { id = addWoredaViewModel.HRDID});
                ViewBag.Errors = 1;
                return RedirectToAction("HRDDetail", new { id = addWoredaViewModel.HRDID });

            }

            catch (Exception ex)
            {
                var log = new Logger();
                log.LogAllErrorsMesseges(ex, _log);

            }

            }

            return PartialView(addWoredaViewModel);
        }
Example #3
0
 private HRDDetail GetDetail(HrdAddWoredaViewModel addWoreda)
 {
     var detail = new HRDDetail()
     {
        HRDID=addWoreda.HRDID,
        WoredaID = addWoreda.WoredaID,
        DurationOfAssistance = addWoreda.Duration,
        NumberOfBeneficiaries = addWoreda.Beneficiary,
        StartingMonth = addWoreda.StartingMonth
     };
     return detail;
 }