private BillingItemViewModel MapToBillingItemView(BillingItem billingItem, int index) { var gstAmt = billingItem.SellingPrice * (billingItem.CGST / 100); return(new BillingItemViewModel { BillingItemId = billingItem.BillingItemId, CGST = billingItem.CGST, SGST = billingItem.SGST, CGSTAmount = gstAmt, SGSTAmount = gstAmt, Description = _billingContext.GetItem(billingItem.ItemId).Description, ItemId = billingItem.ItemId, OriginalPrice = billingItem.OriginalPrice, SellingPrice = billingItem.SellingPrice, PerItemPrice = billingItem.SellingPrice + (gstAmt * 2), Items = _billingContext.GetAllItems().Select(Map).ToList(), TotalPrice = (billingItem.SellingPrice + (gstAmt * 2)) * billingItem.Quantity, Quantity = billingItem.Quantity, Index = index, }); }
public IActionResult Items() { return(View(_billingRepository.GetAllItems().Select(Map).ToList())); }