Exemple #1
0
        public ActionResult Create(int busOperatorId, int routeId, int tripId)
        {
            DateWiseTripCreateView dateWiseTripEditView = new DateWiseTripCreateView
            {
                BusOperatorId = busOperatorId,
                RouteId       = routeId,
                TripId        = tripId
            };

            ViewBag.BusOperator = new SelectList(busOperatorService.GetAll(), "Id", "Name");
            return(View("CreateDateWiseTrip", dateWiseTripEditView));
        }
Exemple #2
0
        public ActionResult SaveNew(DateWiseTripCreateView dateWiseTripCreateView, string tripId)
        {
            int tripID = Convert.ToInt32(tripId);

            if (ModelState.IsValid)
            {
                DateWiseTrip dateWiseTrip = new DateWiseTrip
                {
                    Date       = dateWiseTripCreateView.Date,
                    Fare       = dateWiseTripCreateView.Fare,
                    NoOfSeat   = dateWiseTripCreateView.NoOfSeat,
                    TripBaseId = tripID,
                    IsDeleted  = false,
                    IsActive   = true
                };
                response = dateWiseTripService.Save(dateWiseTrip);
                bookingTicketService.CreateBookingTickets(dateWiseTrip.NoOfSeat, dateWiseTrip.Id);

                switch (response.Success)
                {
                case true:
                    ViewBag.Message = successMessage;
                    ViewBag.Success = true;
                    break;

                case false:
                    ViewBag.Message = failureMessage;
                    ViewBag.Success = false;
                    break;
                }
            }
            DateWiseTripCreateView _dateWiseTripCreateView = new DateWiseTripCreateView
            {
                TripId        = dateWiseTripCreateView.TripId,
                BusOperatorId = dateWiseTripCreateView.BusOperatorId,
                RouteId       = dateWiseTripCreateView.RouteId
            };

            ViewBag.BusOperator = new SelectList(busOperatorService.GetAll(), "Id", "Name");
            return(View("CreateDateWiseTrip", _dateWiseTripCreateView));
        }