private async Task Init() { var requests = await _requestService.Get <List <Request> >(new RequestSearchRequest() { UserId = APIService.loggedProfile.UserId }); Reports.AddRange(requests); OpenReportsNumber = requests.Count; OpenReportsString = "Open reports/requests: " + OpenReportsNumber.ToString(); }
private async Task NewRequest() { string popup = await Application.Current.MainPage.DisplayPromptAsync("New request", "Please type your request in the text box."); if (string.IsNullOrWhiteSpace(popup)) { return; } else { var returnedReq = await _requestService.Insert <Request>(new RequestUpsertRequest() { NameOfUser = APIService.loggedProfile.Username, RequestDate = DateTime.Now, RequestText = popup, UserId = APIService.loggedProfile.UserId }); Reports.Add(returnedReq); OpenReportsNumber++; OpenReportsString = "Open reports/requests: " + OpenReportsNumber.ToString(); await Application.Current.MainPage.DisplayAlert("Success", "Request successfully added!", "OK"); } }