コード例 #1
0
        public IActionResult OrderTickets(CreateOrderBindingModel model)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.RedirectToAction("All", "Events", model));
            }

            try
            {
                this.ordersService.CreateOrder(model);
            }
            catch (Exception e)
            {
                var errorModel = new NotEnoughTicketsErrorViewModel();
                errorModel.TotalTickets = e.Data["Tickets"].ToString();
                return(this.RedirectToAction("NotEnoughTicketsError", errorModel));
            }

            return(this.RedirectToAction("My", "Events"));
        }
コード例 #2
0
 public IActionResult NotEnoughTicketsError(NotEnoughTicketsErrorViewModel model)
 {
     return(this.View(model));
 }