public bool UpdateRegionalPSNPPledge(RegionalPSNPPledge item)
 {
     if (item == null) return false;
     _unitOfWork.RegionalPSNPPledgeRepository.Edit(item);
     _unitOfWork.Save();
     return true;
 }
        public ActionResult Issue(RegionalPSNPPledge regionalPSNPPledge, string pledgeDate)
        {
            regionalPSNPPledge.PledgeDate = DateTime.Now;

            if (ModelState.IsValid)
            {
                _regionalPSNPPledgeService.AddRegionalPSNPPledge(regionalPSNPPledge);
            }

            return RedirectToAction("Index");
        }
 public ActionResult Issue()
 {
     var regionalPSNPPledge = new RegionalPSNPPledge();
     var regionalPSNPPlanList = new List<String>();
     var alreadyReadIDs = new List<int>();
     foreach (var regionalPSNPPlanDetail in _regionalPSNPPlanDetailService.GetAllRegionalPSNPPlanDetail())
     {
         if(alreadyReadIDs.Contains(regionalPSNPPlanDetail.RegionalPSNPPlanID))
             continue;
         var regionalPSNPPlan = _regionalPSNPPlanService.FindById(regionalPSNPPlanDetail.RegionalPSNPPlanID);
         //var region = _adminUnitService.FindById(regionalPSNPPlan.RegionID);
         var regionalPSNPPlanName = regionalPSNPPlan.Year;// +" - " + region.Name;
         regionalPSNPPlanList.Add(regionalPSNPPlanName.ToString());
         alreadyReadIDs.Add(regionalPSNPPlanDetail.RegionalPSNPPlanID);
     }
     ViewBag.RegionalPSNPPlan = new SelectList(regionalPSNPPlanList, "", "", regionalPSNPPledge.RegionalPSNPPlanID = 1);
     ViewBag.DonorID = new SelectList(_donorService.GetAllDonor(), "DonorID", "Name");
     ViewBag.CommodityID = new SelectList(_commodityService.GetAllCommodity(), "CommodityID", "Name");
     ViewBag.UnitID = new SelectList(_unitService.GetAllUnit(), "UnitID", "Name");
     return View();
 }
 public bool AddRegionalPSNPPledge(RegionalPSNPPledge item)
 {
     _unitOfWork.RegionalPSNPPledgeRepository.Add(item);
     _unitOfWork.Save();
     return true;
 }