예제 #1
0
        public HttpResponse Details(string tripId)
        {
            if (!this.IsUserLoggedIn())
            {
                return(this.Redirect("/Users/Login"));
            }

            var trip = this.tripsService.GetTripById(tripId);

            if (trip == null)
            {
                this.Redirect("/Trips/All");
            }

            var viewModel = new DetailsTripViewModel
            {
                Id            = trip.Id,
                StartPoint    = trip.StartPoint,
                EndPoint      = trip.EndPoint,
                DepartureTime = trip.DepartureTime.ToString("dd.MM.yyyy HH:mm"),
                Description   = trip.Description,
                ImagePath     = trip.ImagePath,
                Seats         = trip.Seats
            };

            return(this.View(viewModel));
        }
        public HttpResponse Details(string tripId)
        {
            if (!this.IsUserLoggedIn())
            {
                return(this.Redirect("/Users/Login"));
            }

            if (!this.tripsService.IsTripExist(tripId))
            {
                return(this.Redirect("/"));
            }

            DetailsTripViewModel model = this.tripsService.GetTripDetails(tripId);

            return(this.View(model));
        }