public async Task <ActionResult> IndexAsync(Guid customerId) { var trips = await _tripService.RetrieveTripsForCustomerAsync(customerId); var model = new AllTripsViewModel { CustomerId = customerId, Trips = trips }; return(View(model)); }
public HttpResponse All() { if (!this.IsUserLoggedIn()) { return(this.Redirect("/Users/Login")); } var allTrips = new AllTripsViewModel() { Trips = tripsServcie.GetAllTrips() }; return(this.View(allTrips)); }
public AllTripsViewModel GettAllTrips() { var viewModel = new AllTripsViewModel(); viewModel.Trips = this.db.Trips.Select(t => new TripViewModel { Id = t.Id, StartPoint = t.StartPoint, EndPoint = t.EndPoint, DepartureTime = t.DepartureTime, Seats = t.Seats - t.Users.Count() }) .ToList(); return(viewModel); }
public AllTripsViewModel GetAll() { var model = new AllTripsViewModel(); model.TripList = this.context.Trip .Select(x => new TripListDetailsViewModel { Id = x.Id, StartPoint = x.StartPoint, SeatsAvailable = x.Seats - x.UserTrips.Count, EndPoint = x.EndPoint, DepartureTime = x.DepartureTime.ToString("dd.MM.yyyy HH:mm") }).ToList(); return(model); }
public HttpResponse All() { if (!this.IsUserLoggedIn()) { return(this.Redirect("/Users/Login")); } var trips = this.tripsService.GetAllTrips(); var model = new AllTripsViewModel { Trips = trips, }; return(this.View(model)); }
public IActionResult All([FromQuery] AllTripsViewModel query) { var model = this.tripsService .GetAll( query.SearchTerm, query.Category, query.Sorting, query.CurrentPage, AllTripsViewModel.TripPerPage); var categories = this.categoriesService.All(); model.Categories = categories; return(this.View(model)); }
public AllTripsViewModel GetAllTrips() { var viewModel = new AllTripsViewModel() { Trips = this.db.Trips .Select(x => new TripViewModel() { TripId = x.Id, StartPoint = x.StartPoint, EndPoint = x.EndPoint, DepartureTime = x.DepartureTime, Seats = x.Seats, }).ToList() }; return(viewModel); }
public IActionResult MyTrips() { var userId = this.User.FindFirst(ClaimTypes.NameIdentifier).Value; if (userId == null) { return(this.NotFound()); } var userTrips = this.tripsService.GetAllUserTrips <TripViewModel>(userId); var model = new AllTripsViewModel() { Trips = userTrips }; return(this.View(model)); }
public AllTripsViewModel GetAll() { var tripsList = this.db.Trips.Select(x => new TripViewModel() { Id = x.Id, StartPoint = x.StartPoint, EndPoint = x.EndPoint, DepartureTime = x.DepartureTime, Seats = x.Seats, ImagePath = x.ImagePath }).ToList(); var allTrips = new AllTripsViewModel() { Trips = tripsList }; return(allTrips); }
public HttpResponse All() { if (!this.IsUserLoggedIn()) { return(this.Redirect("/Users/Login")); } var viewModel = new AllTripsViewModel { Trips = this.tripService.GetAll().Select(x => new TripViewModel { Id = x.Id, StartPoint = x.StartPoint, EndPoint = x.EndPoint, DepartureTime = x.DepartureTime, Seats = x.Seats }).ToList() }; return(this.View(viewModel)); }