public ActionResult GenerateToken(CreateTokenModel createTokenModel) { Person person = (Person)Session["Persons"]; ViewBag.JourneyStart = new SelectList(railwayDbContexts.City, "CityName", "CityName"); ViewBag.JourneyEnd = new SelectList(railwayDbContexts.City, "CityName", "CityName"); bool isExist = createTokenModel.isAlreadyPurchseToday(createTokenModel.JourneyDate, person.PersonID); if (isExist) { if (ModelState.IsValid) { createTokenModel.personID = Convert.ToInt32(Session["ID"]); Session["CreateToken"] = createTokenModel; createTokenModel.insertData(createTokenModel); Journey journey = createTokenModel.GetDetails(); UpdateTicketStatusTotalToPending(journey.CoatchType); return(View("FullTicket", journey)); } return(View("GenerateToken")); } else { ModelState.AddModelError("JourneyDate", "You have already purchase a ticket today. Please select another date"); return(View("GenerateToken")); } }
public ActionResult GenerateToken(CreateTokenModel createTokenModel) { createTokenModel.personID = Convert.ToInt32(Session["ID"]); Session["CreateToken"] = createTokenModel; createTokenModel.insertData(createTokenModel); Journey journey = createTokenModel.GetDetails(); UpdateTicketStatusTotalToPending(journey.CoatchType); return(View("FullTicket", journey)); }