private async System.Threading.Tasks.Task AddUserAccess() { AreBtnsEn = false; string newUserEmail = await Application.Current.MainPage.DisplayPromptAsync("New Access", "Insert new user Email:"); if (String.IsNullOrEmpty(newUserEmail)) { return; } string inputNewAccessLevel = await Application.Current.MainPage.DisplayPromptAsync("New Access", "Insert his/her access level: \n 1 - Viewer \n 2 - Editor \n 3 - Admin"); if (String.IsNullOrEmpty(inputNewAccessLevel)) { return; } int newAccessLevel = Convert.ToInt32(inputNewAccessLevel); if (newAccessLevel > 0 && newAccessLevel < 4) { Models.UserListAccess newAccess = new Models.UserListAccess(ListID, newUserEmail, Convert.ToInt32(newAccessLevel)); var addResult = await n_Restctrl.AddUserAccess(newAccess); if (addResult.StatusCode == System.Net.HttpStatusCode.Created) { await Refresh(); } else if (addResult.StatusCode == HttpStatusCode.NotFound) { await Application.Current.MainPage.DisplayAlert("Sorry", "This user does not exists", "Ok"); } else if (addResult.StatusCode == System.Net.HttpStatusCode.Forbidden) { await Application.Current.MainPage.DisplayAlert("Sorry", "This user is in the list already", "Ok"); } else if (addResult.StatusCode == System.Net.HttpStatusCode.Unauthorized) { await Application.Current.MainPage.DisplayAlert("Sorry", "You do not have permission to do this", "Ok"); } else { await Application.Current.MainPage.DisplayAlert("Sorry", "Something went wrong, check your connection", "Ok"); } } else { await Application.Current.MainPage.DisplayAlert("Sorry", "Wrong input format", "Ok"); } AreBtnsEn = true; }