public ActionResult Save(LocationModel location)
 {
     if (ModelState.IsValid)
     {
         try {
             binder.location.Add(location);
             binder.SaveChanges();
         }
         catch (Exception e) {
         }
     }
     return(RedirectToAction("Index"));
 }
 public ActionResult Save(CoachModel coach)
 {
     if (ModelState.IsValid)
     {
         try
         {
             binder.coach.Add(coach);
             binder.SaveChanges();
         }
         catch (Exception e)
         {
         }
     }
     return(RedirectToAction("Index"));;
 }
Exemple #3
0
 public ActionResult Save(TripsModel trips)
 {
     if (ModelState.IsValid)
     {
         try
         {
             binder.trips.Add(trips);
             binder.SaveChanges();
         }
         catch (Exception e)
         {
         }
     }
     return(RedirectToAction("Index"));
 }
        public ActionResult Save(PassengerModel model, string selectedSeats, long boardingPoint, long droppingPoint, string payment)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    binder.passenger.Add(model);
                    binder.SaveChanges();

                    BookingModel bkModel = new BookingModel();
                    bkModel.PassengerId   = model.Id;
                    bkModel.TripId        = trpId;
                    bkModel.BoardingPoint = boardingPoint;
                    bkModel.DroppingPoint = droppingPoint;
                    bkModel.PaymentMethod = payment;
                    binder.booking.Add(bkModel);
                    binder.SaveChanges();

                    string[] seat = selectedSeats.Split(' ');

                    for (int i = 0; i < seat.Length - 1; i++)
                    {
                        BookingList bkList = new BookingList();
                        bkList.BookingId = bkModel.Id;
                        bkList.SeatNo    = seat[i];
                        binder.bookingList.Add(bkList);
                        binder.SaveChanges();
                    }
                }
                catch (Exception e)
                {
                }
            }

            return(RedirectToAction("Index", "Home"));
        }
        public ActionResult Save(RegisterModel register)
        {
            /* if(string.IsNullOrEmpty(register.Name))
             * {
             *   ModelState.AddModelError("Name", "Name is compulsory");
             *   return RedirectToAction("Index", "Home");
             * }*/
            if (ModelState.IsValid)
            {
                try
                {
                    binder.register.Add(register);
                    binder.SaveChanges();

                    TempData["Success"] = "Registration Done Successfully....";
                }
                catch (Exception e)
                {
                }
            }
            return(RedirectToAction("Index", "Home"));
        }