コード例 #1
0
        public HttpResponse All()
        {
            if (!this.IsUserLoggedIn())
            {
                return(this.Redirect("/Users/Login"));
            }

            var model = new List <TripsViewModel>();

            var trips = service.GetAll();

            foreach (var trip in trips)
            {
                model.Add(new TripsViewModel
                {
                    DepartureTime = trip.DepartureTime.ToString(),
                    EndPoint      = trip.EndPoint,
                    Id            = trip.Id,
                    Seats         = trip.Seats,
                    StartPoint    = trip.StartPoint
                });
            }

            return(this.View(model.ToArray()));
        }
コード例 #2
0
        public HttpResponse All()
        {
            if (!this.IsUserLoggedIn())
            {
                return(this.Redirect("/Users/Login"));
            }
            var viewModel = tripsService.GetAll();

            return(this.View(viewModel, "All"));
        }
コード例 #3
0
        public HttpResponse All()
        {
            if (!this.IsUserLoggedIn())
            {
                return(this.Redirect("/Users/Login"));
            }
            var allTrips = tripsService.GetAll();

            return(this.View(allTrips));
        }
コード例 #4
0
        public HttpResponse All()
        {
            if (this.IsUserLoggedIn())
            {
                var allTrips = tripService.GetAll();

                return(this.View(allTrips));
            }

            return(this.View($"/"));
        }