/// <summary>
/// Update PurcheaseReturnDetails
/// </summary>
/// <param name="entity"></param>
/// <returns>Message</returns>
        public async Task <string> UpdatePurcheaseReturnDetails(PurcheaseReturnDetails entity)
        {
            try
            {
                var result = await new PurcheaseReturnDetailsRepository(logger).Update(entity);
                return(result);
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                throw ex;
            }
        }
        public async Task <ActionResult> Edit(PurcheaseReturnDetails data)
        {
            string result = string.Empty;

            try
            {
                result = await repo.UpdatePurcheaseReturnDetails(data);
            }
            catch (Exception ex)
            {
                throw;
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public async Task <JsonResult> Delete(string ids)
        {
            string result = string.Empty;

            string[] IdList           = ids.Split('~');
            PurcheaseReturnDetails vm = new PurcheaseReturnDetails();

            try
            {
                result = await repo.IsDeletePurcheaseReturnDetails(IdList, vm);
            }
            catch (Exception ex)
            {
                throw;
            }
            return(Json(result, 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));
        }
/// <summary>
/// Delete PurcheaseReturnDetails
/// </summary>
/// <param name="Id"></param>
/// <returns>Message</returns>
        public async Task <string> IsDeletePurcheaseReturnDetails(string[] IdList, PurcheaseReturnDetails entity)
        {
            string result = string.Empty;

            try
            {
                for (int i = 0; i < IdList.Length - 1; i++)
                {
                    result = await new PurcheaseReturnDetailsRepository(logger).IsDelete(Convert.ToInt32(IdList[i]), entity);
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                throw ex;
            }
            return(result);
        }