public ActionResult AddCommodity(int id )
 {
     var request = _regionalRequestService.FindById(id);
     ViewBag.CommodityID = new SelectList(_commonService.GetRationCommodity(request.RationID), "CommodityID", "Name");
     var addCommodityViewModel = new AddCommodityViewModel();
     addCommodityViewModel.RegionalRequestID = request.RegionalRequestID;
     return PartialView(addCommodityViewModel);
 }
        public ActionResult AddCommodity(AddCommodityViewModel addCommodity)
        {
            if (ModelState.IsValid)
            {
                if(addCommodity.ChkAllCommodities)
                {
                    _regionalRequestDetailService.AddAllCommodity(addCommodity.RegionalRequestID);
                    return RedirectToAction("Allocation", new { id = addCommodity.RegionalRequestID });
                }

                _regionalRequestDetailService.AddRequestDetailCommodity(addCommodity.CommodityID, addCommodity.RegionalRequestID);
                return RedirectToAction("Allocation", new { id = addCommodity.RegionalRequestID });
            }
            ModelState.AddModelError("Errors",@"Unable to add Commodity");
            return RedirectToAction("Allocation", new {id = addCommodity.RegionalRequestID});
        }
Exemple #3
0
 public ActionResult AddCommodity(AddCommodityViewModel addCommodity)
 {
     if (ModelState.IsValid)
     {
         _regionalRequestDetailService.AddRequestDetailCommodity(addCommodity.CommodityID, addCommodity.RegionalRequestID);
         return RedirectToAction("Allocation", new { id = addCommodity.RegionalRequestID });
     }
     return RedirectToAction("Allocation", new {id = addCommodity.RegionalRequestID});
 }