示例#1
0
        public ActionResult Edit(int billNo, [FromBody] BillCreateJsonModel modelJson)
        {
            var url = "";

            try
            {
                var model = modelJson;
                if (billNo > 0 && ModelState.IsValid && model != null && model.CustomerId >= 0)
                {
                    var billItems = model.Items.Select(b => GetBillingItem(b)).ToList();
                    var bill      = GetBill(model);
                    bill.BillId = billNo;
                    var billno = _billingContext.UpdateBill(bill, billItems);

                    url = Url.Action("Print?billNo=" + billno);
                    return(new JsonResult(new Dictionary <string, string>()
                    {
                        { "RedirectURL", url }
                    }));
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            throw new Exception(" Model state is invlaid or invalid inputs!");
        }