public static GreenBeansState OnGreenBeansInitialized(GreenBeansState state) { return(state with { Initialized = true }); }
public static GreenBeansState OnSubmit(GreenBeansState state) { return(state with { Submitting = true }); }
public static GreenBeansState OnGreenBeanLoad(GreenBeansState state) { return(state with { Loading = true }); }
public static GreenBeansState OnUpdateFailure(GreenBeansState state, GreenBeanUpdateFailureAction action) { return(state with { Submitting = false, ErrorMessage = action.ErrorMessage }); }
public static GreenBeansState OnUpdateSuccess(GreenBeansState state) { return(state with { Submitting = false, Submitted = true }); }
public static GreenBeansState OnStopEditGreenBeanInfo(GreenBeansState state, GreenBeanStopEditAction action) { return(state with { CurrentGreenBean = action.GreenBeanInfo, GreenBeanButtonText = "Create", }); }
public static GreenBeansState OnGreenBeanSet(GreenBeansState state, GreenBeansSetAction action) { return(state with { GreenBeans = action.GreenBeanInfos, Loading = false }); }
public static GreenBeansState OnEditGreenBean(GreenBeansState state, GreenBeanEditAction action) { return(state with { Submitted = false, Submitting = false, ShowInputDialog = true, CurrentGreenBean = action.GreenBeanInfo, GreenBeanButtonText = "Update" }); }
public static GreenBeansState OnSaveGreenBean(GreenBeansState state, GreenBeansSaveAction action) { return(state with { Submitted = false, Submitting = true, CurrentGreenBean = new CoffeeRoastManagement.Shared.Entities.GreenBeanInfo(), GreenBeanButtonText = "Create", ShowInputDialog = false, GreenBeanEditMode = false }); }
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 { }); }
public static GreenBeansState OnAddGreenBean(GreenBeansState state, GreenBeanAddAction action) { // handle all cases, the last return statement handles the default case if (state.ShowInputDialog && state.GreenBeanEditMode) { // we reset everything return(state with { ShowInputDialog = true, GreenBeanEditMode = false, CurrentGreenBean = new CoffeeRoastManagement.Shared.Entities.GreenBeanInfo(), GreenBeanButtonText = "Create" }); } if (state.ShowInputDialog && !state.GreenBeanEditMode) { if (!string.IsNullOrEmpty(state.CurrentGreenBean.Name) || !string.IsNullOrEmpty(state.CurrentGreenBean.Note) || !string.IsNullOrEmpty(state.CurrentGreenBean.Url) || !string.IsNullOrEmpty(state.CurrentGreenBean.Country) || !string.IsNullOrEmpty(state.CurrentGreenBean.Farmer) || !string.IsNullOrEmpty(state.CurrentGreenBean.Processing) || !string.IsNullOrEmpty(state.CurrentGreenBean.Region) || !string.IsNullOrEmpty(state.CurrentGreenBean.Variety) || state.CurrentGreenBean.Crop != 0 || state.CurrentGreenBean.OverallCuppingScore != 0 ) { return(state with { CurrentGreenBean = new CoffeeRoastManagement.Shared.Entities.GreenBeanInfo(), GreenBeanButtonText = "Create", }); } else { return(state with { CurrentGreenBean = new CoffeeRoastManagement.Shared.Entities.GreenBeanInfo(), GreenBeanButtonText = "Create", ShowInputDialog = false, }); } } return(state with { ShowInputDialog = true, }); }