Exemple #1
0
 public ActionResult ReturnTicket(int ticketId)
 {
     using (WorkWithDatabase db = new WorkWithDatabase())
     {
         Ticket tic = db.GetEntityById <Ticket, int>(ticketId);
         tic.IsDeleted = true;
         db.Commit();
     }
     return(RedirectToAction("TicketInformation"));
 }
Exemple #2
0
 public ActionResult BuyBookTicket(int tickId)
 {
     using (WorkWithDatabase db = new WorkWithDatabase())
     {
         Ticket tick = db.GetEntityById <Ticket, int>(tickId);
         tick.Condition = TypeOfTicketEnum.Bought;
         db.Commit();
     }
     return(RedirectToAction("TicketInformation"));
 }
Exemple #3
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());
     }
 }
Exemple #4
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());
     }
 }
 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 ReturnTicket(int ticketId)
 {
     using (WorkWithDatabase db = new WorkWithDatabase())
     {
         Ticket tic = db.GetEntityById<Ticket, int>(ticketId);
         tic.IsDeleted = true;
         db.Commit();
     }
     return RedirectToAction("TicketInformation");
 }
 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 BuyBookTicket(int tickId)
 {
     using (WorkWithDatabase db = new WorkWithDatabase())
     {
         Ticket tick = db.GetEntityById<Ticket, int>(tickId);
         tick.Condition = TypeOfTicketEnum.Bought;
         db.Commit();
     }
     return RedirectToAction("TicketInformation");
 }