public IActionResult Buy(GetBuyViewModel model) { try { var user = new User() { FirstName = model.FirstName, LastName = model.LastName, Address = model.Address, PhoneNumber = model.PhoneNumber, Email = model.Email, }; _userService.AddUser(user); var buy = new Buy() { User = user, IsSuccessfullyBuying = false, Price = 0, Tickets = new List <Ticket>() }; foreach (var ticket in model.Tickets) { var tempTicket = _matchService.GetTicketByMatchNameAndSector(ticket.MatchName, ticket.Sector); buy.Price += tempTicket.Price; buy.Tickets.Add(tempTicket); } _buyService.CreateBuyModel(buy); return(View("_ThankYou")); } catch (Exception ex) { var message = "We don't have selected ticket/s at this moment, pease select another one."; return(RedirectToAction("Buy", "Buy", new { error = message, tickets = model.Tickets.Count })); } }