public ActionResult RemoveGRDataforReturnforrdm(int id) { var checkStatusofGr = obj.GetDoc().Where(x => x.DocumentNo == id && x.DocStatus == "Open").FirstOrDefault(); if (checkStatusofGr != null) { ReqList li = new ReqList(); DataSet ds = li.Remove_GRdataforrdm(id); List <ProcureVM> list = new List <ProcureVM>(); foreach (DataRow dr in ds.Tables[0].Rows) { list.Add(new ProcureVM { ItemName = dr["ItemName"].ToString(), Quantity = Convert.ToInt32(dr["ApprovedQtybyQuality"]) }); } return(Json(list, JsonRequestBehavior.AllowGet)); } else { ReqList li = new ReqList(); DataSet ds = li.Remove_GRdataforrd(id); List <ProcureVM> list = new List <ProcureVM>(); foreach (DataRow dr in ds.Tables[0].Rows) { list.Add(new ProcureVM { ItemName = dr["ItemName"].ToString(), Quantity = Convert.ToInt32(dr["DeliveredQuantity"]) }); } return(Json(list, JsonRequestBehavior.AllowGet)); } }