Exemplo n.º 1
0
        public HttpResponse Details(TripsDetailsViewModel model)
        {
            if (!this.IsUserLoggedIn())
            {
                return(this.Redirect("/Users/Register"));
            }

            var trip = this.tripsService.GetTripById(model.Id);

            return(this.View(trip));
        }
        public HttpResponse Details(string tripId)
        {
            var tripsQuery = data.Trips.FirstOrDefault(t => t.Id == tripId);

            if (tripsQuery == null)
            {
                return(Error("Selected trip doesn't exist."));
            }

            var trip = new TripsDetailsViewModel
            {
                ImagePath     = tripsQuery.ImagePath,
                TripId        = tripsQuery.Id,
                StartPoint    = tripsQuery.StartPoint,
                EndPoint      = tripsQuery.EndPoint,
                DepartureTime =
                    tripsQuery.DepartureTime.ToString("dd.MM.yyyy HH:mm",
                                                      CultureInfo.InvariantCulture), // not sure if that format has a short symbol
                Seats       = tripsQuery.Seats,
                Description = tripsQuery.Description
            };

            return(View(trip));
        }