Example #1
0
        public async Task DeleteGreenBean(GreenBeansDeleteAction action, IDispatcher dispatcher)
        {
            var result = await _httpClient.DeleteAsync($"api/greenbeaninfo/{action.GreenBeanInfo.Id}");

            if (result.IsSuccessStatusCode)
            {
                dispatcher.Dispatch(new GreenBeansDeleteSuccessAction());
            }
            else
            {
                dispatcher.Dispatch(new GreenBeansDeleteFailureAction(result.ReasonPhrase));
            }
            dispatcher.Dispatch(new GreenBeansLoadAction());
        }
Example #2
0
 public static GreenBeansState OnCGreenBeanDelete(GreenBeansState state, GreenBeansDeleteAction action)
 {
     if (state.CurrentGreenBean.Id == action.GreenBeanInfo.Id)
     {
         return(state with
         {
             CurrentGreenBean = new CoffeeRoastManagement.Shared.Entities.GreenBeanInfo(),
             GreenBeanButtonText = "Create"
         });
     }
     return(state with
     {
     });
 }