public ActionResult PurcheaseDetail(int proid,string unitprice,string quantity) { Products data; PurcheaseDetails PurcheaseDetail=new PurcheaseDetails(); try { data = prorepo.DropDownProducts().Result.FirstOrDefault(c => c.Id.Equals(proid)); PurcheaseDetail.Quantity = Convert.ToDecimal(quantity); PurcheaseDetail.UnitePrice = Convert.ToDecimal(unitprice); PurcheaseDetail.ProductId = proid; PurcheaseDetail.TotalPrice = PurcheaseDetail.Quantity* PurcheaseDetail.UnitePrice; } catch (Exception ex) { throw ex; } return PartialView(PurcheaseDetail); }
public async Task <JsonResult> DropDownProducts() { dynamic result; try { result = await repo.DropDownProducts(); } catch (Exception ex) { throw ex; } return(Json(new SelectList((result), "Id", "Name"), JsonRequestBehavior.AllowGet)); }
public ActionResult SalesDetail(int proid, string unitprice, string quantity, string slup) { Products data; SalesDetails SalesDetails = new SalesDetails(); try { data = prorepo.DropDownProducts().Result.FirstOrDefault(c => c.Id.Equals(proid)); SalesDetails.SalesQuantity = Convert.ToDecimal(quantity); SalesDetails.UnitePrice = Convert.ToDecimal(unitprice); SalesDetails.Slup = Convert.ToDecimal(slup); SalesDetails.ProductId = proid; SalesDetails.ProductName = data.Name; SalesDetails.ProductCode = data.Code; SalesDetails.TotalAmount = SalesDetails.SalesQuantity * SalesDetails.UnitePrice - SalesDetails.Slup; } catch (Exception ex) { throw ex; } return(PartialView(SalesDetails)); }