Пример #1
0
        public JsonResult Create([FromBody] BillCreateJsonModel modelJson)
        {
            var url = "";

            try
            {
                var model = modelJson;
                if (ModelState.IsValid && model != null && model.CustomerId >= 0)
                {
                    var billItems = model.Items.Select(b => GetBillingItem(b)).ToList();
                    var billno    = _billingContext.CreateBill(GetBill(model), 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!");
        }