public async void ActivateRoom() { var connection = await apiService.CheckConnection(); if (!connection.IsSuccess) { await Application.Current.MainPage.DisplayAlert( Languages.Warning, Languages.CheckConnection, Languages.Ok); return; } var cookie = Settings.Cookie; //.Split(11, 33) var res = cookie.Substring(11, 32); var response = await apiService.GetAttachmentWithCoockie <Room>( "https://portalesp.smart-path.it", "/Portalesp", "/room/activate?id=" + Room.id, res); if (!response.IsSuccess) { await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok"); return; } //RequestsViewModel.GetInstance().Update(deleteRequest); await RoomViewModel.GetInstance().Activate(Room); DependencyService.Get <INotification>().CreateNotification("PortalSP", "Room Activated"); await PopupNavigation.Instance.PopAsync(true); }
public async void deleteRoom() { Value = true; var connection = await apiService.CheckConnection(); if (!connection.IsSuccess) { await Application.Current.MainPage.DisplayAlert( Languages.Warning, Languages.CheckConnection, Languages.Ok); return; } if (string.IsNullOrEmpty(Reason)) { Value = true; return; } var room = new RoomDeactivate { id = Room.id, reason = Reason }; var cookie = Settings.Cookie; //.Split(11, 33) var res = cookie.Substring(11, 32); var response = await apiService.Save <RoomDeactivate>( "https://portalesp.smart-path.it", "/Portalesp", "/room/deactivate", res, room); if (!response.IsSuccess) { await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok"); return; } await RoomViewModel.GetInstance().Activate(Room); //RequestsViewModel.GetInstance().Update(deleteRequest); Value = false; DependencyService.Get <INotification>().CreateNotification("PortalSP", "Room Deactivated"); //await App.Current.MainPage.Navigation.PopPopupAsync(true); await PopupNavigation.Instance.PopAsync(true); }
public async void EditRoom() { Value = true; var connection = await apiService.CheckConnection(); if (!connection.IsSuccess) { await Application.Current.MainPage.DisplayAlert( Languages.Warning, Languages.CheckConnection, Languages.Ok); return; } if (string.IsNullOrEmpty(Room.code) || string.IsNullOrEmpty(Room.name)) { Value = true; return; } if (SelectedType == null) { await Application.Current.MainPage.DisplayAlert("Error", "Please Select Type", "ok"); Value = true; return; } var room = new RoomUpdate { id = Room.id, active = Room.active, code = Room.code, name = Room.name, description = Room.description, type = SelectedType.Key, createBy = Room.createBy, deleteBy = Room.deleteBy, //createDate = Room.createDate.ToString(), //deleteDate = Room.deleteDate.ToString(), deleteReason = Room.deleteReason }; var cookie = Settings.Cookie; //.Split(11, 33) var res = cookie.Substring(11, 32); var response = await apiService.Put <RoomUpdate>( "https://portalesp.smart-path.it", "/Portalesp", "/room/update", res, room); Debug.WriteLine("********responseIn ViewModel*************"); Debug.WriteLine(response); /* if (!response.IsSuccess) * { * await Application.Current.MainPage.DisplayAlert("Error", response.Message, "ok"); * return; * }*/ Value = false; RoomViewModel.GetInstance().Update(Room); DependencyService.Get <INotification>().CreateNotification("PortalSP", "Room Updated"); await App.Current.MainPage.Navigation.PopPopupAsync(true); }