Пример #1
0
        public IActionResult Index(Ticket ticket)
        {
            if (ModelState.IsValid && db.VerifyNewTicket(ticket.SerialNumber))
            {
                var _ticket = new Ticket
                {
                    FirstName    = ticket.FirstName,
                    SurName      = ticket.SurName,
                    Email        = ticket.Email,
                    PhoneNumber  = ticket.PhoneNumber,
                    DateOfBirth  = ticket.DateOfBirth,
                    SerialNumber = ticket.SerialNumber
                };

                db.AddTicket(_ticket);

                return(RedirectToAction("Tickets"));
            }
            else
            {
                ViewData.Add("SerialErrorMessage", "The serial key you entered is either invalid or already used");
            }

            return(View());
        }