コード例 #1
0
        public async Task DeleteStock(StockDeleteAction action, IDispatcher dispatcher)
        {
            var result = await _httpClient.DeleteAsync($"api/stock/{action.Stock.Id}");

            if (result.IsSuccessStatusCode)
            {
                dispatcher.Dispatch(new StockDeleteSuccessAction());
            }
            else
            {
                dispatcher.Dispatch(new StockDeleteFailureAction(result.ReasonPhrase));
            }
            dispatcher.Dispatch(new StocksLoadAction());
        }
コード例 #2
0
 public static StocksState OnStockDelete(StocksState state, StockDeleteAction action)
 {
     if (state.CurrentStock.Id == action.Stock.Id)
     {
         return(state with
         {
             SelectedContact = new CoffeeRoastManagement.Shared.Entities.Contact(),
             SelectedGreenBeanInfo = new CoffeeRoastManagement.Shared.Entities.GreenBeanInfo(),
             CurrentStock = new CoffeeRoastManagement.Shared.Entities.Stock(),
             StockButtonText = "Create"
         });
     }
     return(state with
     {
     });
 }