public static ContactsState OnSaveContact(ContactsState state, ContactsSaveAction action)
 {
     return(state with
     {
         Submitted = false,
         Submitting = true,
         CurrentContact = new CoffeeRoastManagement.Shared.Entities.Contact(),
         ContactButtonText = "Create",
         ShowInputDialog = false,
         ContactEditMode = false
     });
 }
 public static ContactsState OnContactsDelete(ContactsState state, ContactsDeleteAction action)
 {
     if (state.CurrentContact.Id == action.Contact.Id)
     {
         return(state with
         {
             CurrentContact = new CoffeeRoastManagement.Shared.Entities.Contact(),
             ContactButtonText = "Create"
         });
     }
     return(state with
     {
     });
 }
 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
     {
     });
 }
 public static ContactsState OnAddContact(ContactsState state, ContactAddAction action)
 {
     // handle all cases, the last return statement handles the default case
     if (state.ShowInputDialog && state.ContactEditMode)
     {
         // we reset everything
         return(state with
         {
             ShowInputDialog = true,
             ContactEditMode = false,
             CurrentContact = new CoffeeRoastManagement.Shared.Entities.Contact(),
             ContactButtonText = "Create"
         });
     }
     if (state.ShowInputDialog && !state.ContactEditMode)
     {
         if (!string.IsNullOrEmpty(state.CurrentContact.Name) || !string.IsNullOrEmpty(state.CurrentContact.Note) || !string.IsNullOrEmpty(state.CurrentContact.Url))
         {
             return(state with
             {
                 CurrentContact = new CoffeeRoastManagement.Shared.Entities.Contact(),
                 ContactButtonText = "Create",
             });
         }
         else
         {
             return(state with
             {
                 CurrentContact = new CoffeeRoastManagement.Shared.Entities.Contact(),
                 ContactButtonText = "Create",
                 ShowInputDialog = false,
             });
         }
     }
     return(state with
     {
         ShowInputDialog = true,
     });
 }
示例#5
0
 public StockSaveAction(CoffeeRoastManagement.Shared.Entities.Contact contact, CoffeeRoastManagement.Shared.Entities.GreenBeanInfo greenBean, CoffeeRoastManagement.Shared.Entities.Stock stock)
 {
     Contact   = contact;
     GreenBean = greenBean;
     Stock     = stock;
 }
示例#6
0
 public SetSelectedContactAction(CoffeeRoastManagement.Shared.Entities.Contact contact)
 {
     Contact = contact;
 }
 public ContactSubmitAction(CoffeeRoastManagement.Shared.Entities.Contact contact)
 {
     Contact = contact;
 }
 public ContactStopEditAction()
 {
     Contact = new CoffeeRoastManagement.Shared.Entities.Contact();
 }