public async void UpdateRequestsList() { RefreshList = true; var temp = await RequestViewModel.SearchByUser(App.LoggedInUser.ID); if (temp != null) { requests.Clear(); foreach (var req in temp) { if (req.PrinterId != null) { req.Printer = await PrinterViewModel.SearchByID(req.PrinterId); } if (req.StatusId != null) { req.Status = await StatusViewModel.SearchByID(req.StatusId); } if (req.ApplicationUserId != null) { req.User = await UserViewModel.SearchByID(req.ApplicationUserId); } if (req.Id != null) { req.Messages = await MessageViewModel.SearchByRequestID(req.Id); } requests.Add(req); } } RefreshList = false; }
public static async Task <PrinterViewModel> PopulateForeignKeys(PrinterViewModel printer) { if (printer.StatusID != null) { printer.Status = await StatusViewModel.SearchByID(printer.StatusID); } if (printer.ColorID != null) { printer.PrintColor = await PrintColorViewModel.SearchByID(printer.ColorID); } var requests = await RequestViewModel.SearchByPrinter(printer); if (requests != null) { printer.Requests = requests; } return(printer); }
private static async Task <RequestViewModel> GetForeignKeys(RequestViewModel requestViewModel) { if (requestViewModel.PrinterId != null) { requestViewModel.Printer = await PrinterViewModel.SearchByID(requestViewModel.PrinterId); } if (requestViewModel.StatusId != null) { requestViewModel.Status = await StatusViewModel.SearchByID(requestViewModel.StatusId); } if (requestViewModel.ApplicationUserId != null) { requestViewModel.User = await UserViewModel.SearchByID(requestViewModel.ApplicationUserId); } if (requestViewModel.Id != null) { requestViewModel.Messages = await MessageViewModel.SearchByRequestID(requestViewModel.Id); } return(requestViewModel); }