public MyCarsPage() { InitializeComponent(); BindingContext = _viewModel = new MyCarsViewModel(); }
public async Task <IActionResult> MyCars() { var userId = await this.usersService.GetUserIdByUsernameAsync(this.User.Identity.Name); var cars = await this.carsService.GetAllCarsByUserIdAsync(userId); var viewModel = new MyCarsViewModel { Cars = cars }; return(this.View(viewModel)); }
public IActionResult MyCars(int id = 1) { if (id <= 0) { return(this.NotFound()); } const int ItemsPerPage = 6; var username = this.userManager.GetUserName(this.User); var viewModel = new MyCarsViewModel { ItemsPerPage = ItemsPerPage, PageNumber = id, CarsCount = this.carsService.GetMyCount(username), Cars = this.carsService.GetUserCars <MyCarsInListViewModel>(username, id, ItemsPerPage), }; return(this.View(viewModel)); }