public ViewResult Registration(Person regPerson) { if (ModelState.IsValid) { Session[BookTickets.Properties.Resources.LogInUserPassword] = regPerson.Password.GetHashCode().ToString(); Session[BookTickets.Properties.Resources.LogInUserName] = regPerson.LogName; using (WorkWithDatabase db = new WorkWithDatabase()) { regPerson.Password = regPerson.Password.GetHashCode().ToString(); db.Insert <Person>(regPerson); db.Commit(); } return(View("Thanks", regPerson)); } else { return(View()); } }
public ActionResult Buy(Ticket tick) { if (tick.NumberOfPlace != 0) { using (WorkWithDatabase db = new WorkWithDatabase()) { tick.Condition = TypeOfTicketEnum.Bought; string s1 = Session[BookTickets.Properties.Resources.LogInUserName].ToString(); string s2 = Session[BookTickets.Properties.Resources.LogInUserPassword].ToString(); var per = db.GetEntityList <Person>().Where(x => x.LogName.Equals(s1) && x.Password.Equals(s2)).FirstOrDefault(); var route = db.GetEntityById <Route, int>(tick.Route.RouteID); tick.Person = per; tick.Route = route; db.Insert <Ticket>(tick); db.Commit(); } return(RedirectToAction("TicketInformation")); } else { return(View()); } }
public ActionResult Buy(Ticket tick) { if (tick.NumberOfPlace != 0) { using (WorkWithDatabase db = new WorkWithDatabase()) { tick.Condition = TypeOfTicketEnum.Bought; string s1 = Session[BookTickets.Properties.Resources.LogInUserName].ToString(); string s2 = Session[BookTickets.Properties.Resources.LogInUserPassword].ToString(); var per = db.GetEntityList<Person>().Where(x => x.LogName.Equals(s1) && x.Password.Equals(s2)).FirstOrDefault(); var route = db.GetEntityById<Route, int>(tick.Route.RouteID); tick.Person = per; tick.Route = route; db.Insert<Ticket>(tick); db.Commit(); } return RedirectToAction("TicketInformation"); } else { return View(); } }
public ViewResult Registration(Person regPerson) { if (ModelState.IsValid) { Session[BookTickets.Properties.Resources.LogInUserPassword] = regPerson.Password.GetHashCode().ToString(); Session[BookTickets.Properties.Resources.LogInUserName] = regPerson.LogName; using (WorkWithDatabase db = new WorkWithDatabase()) { regPerson.Password = regPerson.Password.GetHashCode().ToString(); db.Insert<Person>(regPerson); db.Commit(); } return View("Thanks", regPerson); } else { return View(); } }