Пример #1
0
        public IActionResult Edit(int?id)
        {
            if (id.HasValue)
            {
                var item = Map(_billingContext.GetItem(id.Value));

                return(View(item));
            }
            return(Index());
        }
Пример #2
0
        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,
            });
        }