public async void Unsubscribe(Model.Subscription subscription) { Subscriptions.Remove(subscription); Model.Delete delete = new Model.Delete() { Item = BuyItem.Subscription, ItemId = subscription.SubscriptionId, UserId = APIService.User.UserId }; await _usersApi.Delete <Model.Subscription>(delete); HasNotifications = "True"; }
public async Task <string> Delete <T>(Model.Delete delete) { var url = $"{_apiUrl}/{_controller}/DeleteItem"; try { var result = await url.WithBasicAuth(Username, Password).PostJsonAsync(delete).ReceiveString(); return(result); } catch (FlurlHttpException ex) { if (ex.Call.HttpStatus == System.Net.HttpStatusCode.Unauthorized) { await Application.Current.MainPage.DisplayAlert("Error", "Access denied!", "OK"); } if (ex.Call.HttpStatus == System.Net.HttpStatusCode.Forbidden) { await Application.Current.MainPage.DisplayAlert("Error", "Access forbidden!", "OK"); } throw; } }
public ActionResult <string> Delete(Model.Delete delete) { return(_service.DeleteItem(delete)); }