Esempio n. 1
0
        public ActionResult Create([Bind(Include = "Date,From,To,Passenger,Status")] Booking booking, Status status)
        {
            if (ModelState.IsValid)
            {
                db.Bookings.Add(booking);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(booking));
        }
Esempio n. 2
0
        public void SubTicket(TheatreTicketBooking.Client.Entities.Premiere current)
        {
            foreach (Premiere cur in dataEntity.Premiere.Where(cur => cur.PremiereID == current.ID))
            {
                cur.TicketCapacity = current.TicketCount - 1;
            }

            dataEntity.SaveChanges();
        }
Esempio n. 3
0
 public ActionResult SignUp(User user)
 {
     _context.Users.Add(user);
     _context.SaveChanges();
     return(View());
 }
 public ActionResult AddBusService(BusService busService, HttpPostedFileBase UpdateImage, HttpPostedFileBase Image)
 {
     if (busService.Id > 0)
     {
         if (UpdateImage != null)
         {
             string filename = UpdateImage.FileName;
             busService.Image = filename;
             string path = Path.Combine(Server.MapPath("/Images"), filename);
             UpdateImage.SaveAs(path);
         }
         _context.Entry(busService).State = EntityState.Modified;
         _context.SaveChanges();
         return(RedirectToAction("BusService"));
     }
     else
     {
         string filename = Image.FileName;
         busService.Image = filename;
         string path = Path.Combine(Server.MapPath("/Images"), filename);
         Image.SaveAs(path);
         _context.BusServices.Add(busService);
         _context.SaveChanges();
         return(RedirectToAction("BusService"));
     }
 }