public JsonResult GetRation() { var ration = _rationService.Get(t => (bool)t.IsDefaultRation, null, "RationDetails").FirstOrDefault(); var rationViewModel = (from item in ration.RationDetails select new { _commodityService.FindById(item.CommodityID).Name, Value = item.Amount }); return(Json(rationViewModel, JsonRequestBehavior.AllowGet)); }
public ActionResult Edit(int id) { var relifRequisition = _reliefRequisitionService.FindById(id); if (relifRequisition != null) { //ViewBag.RationSelected = relifRequisition.RationID; //ViewBag.RationID = _rationService.GetAllRation(); if (relifRequisition.ProgramID == (int)Programs.PSNP) { ViewBag.program = "PSNP"; } ViewBag.RationID = new SelectList(_rationService.Get(t => t.RationDetails.Select(m => m.CommodityID).Contains((int)relifRequisition.CommodityID)), "RationID", "RefrenceNumber", relifRequisition.RationID); return(View(relifRequisition)); } return(HttpNotFound()); }