public async Task <IActionResult> GetUpdate(int id) { try { var entity = await Manager.FindById(id); var TravellersList = await TravellersManager.All(); var TravelList = await TravelsManager.All(); RequestsViewModel viewModel = new RequestsViewModel { Travellers = new Travellers { ID_Travellers = entity.travellers.ID_Travellers }, Travels = new Travels { ID_Travels = entity.travels.ID_Travels }, ID_Requests = entity.ID_Requests }; FillTravellersList(viewModel, TravellersList.ToList()); FillTravelList(viewModel, TravelList.ToList()); viewModel.Requests = await Manager.All(); return(View("Index", viewModel)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> Index() { RequestsViewModel viewModel = new RequestsViewModel(); var TravellersList = await TravellersManager.All(); var TravelList = await TravelsManager.All(); FillTravellersList(viewModel, TravellersList.ToList()); FillTravelList(viewModel, TravelList.ToList()); viewModel.Requests = await Manager.All(); return(View(viewModel)); }