Example #1
0
 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());
     }
 }
Example #2
0
 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());
     }
 }
Example #3
0
 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();
     }
 }
Example #4
0
 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();
     }
 }