public JsonResult DropDownPurchasesByPurcheaseId(int Id)
 {
     dynamic result;
     try
     {
         result = from pro in repo.GetAllPurchases().Result
                  join prod in prodrepo.GetAllPurcheaseDetails().Result on pro.Id equals prod.PurchaseId
                  join product in prorepo.DropDownProducts().Result on prod.ProductId equals product.Id
                  where pro.Id.Equals(Id)
                  select new { Id = prod.ProductId, Name = product.Name };
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return Json(new SelectList((result), "Id", "Name"), JsonRequestBehavior.AllowGet);
 }
        public ActionResult PurcheaseReturnDetail(int proid, string quantity)
        {
            PurcheaseReturnDetails PurcheaseReturnDetails = new PurcheaseReturnDetails();

            try
            {
                var data = repoPur.GetAllPurcheaseDetails().Result.FirstOrDefault(c => c.Id.Equals(proid));
                PurcheaseReturnDetails.Quantity   = Convert.ToDecimal(quantity);
                PurcheaseReturnDetails.ProductId  = proid;
                PurcheaseReturnDetails.UnitePrice = data.UnitePrice;
                PurcheaseReturnDetails.TotalPrice = PurcheaseReturnDetails.Quantity * PurcheaseReturnDetails.UnitePrice;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(PartialView(PurcheaseReturnDetails));
        }