Example #1
0
 /// <summary>
 /// Gets the state machine.
 /// </summary>
 protected virtual StateMachine <AccountStates, AccountTriggers> GetStateMachine(IAccountDataModel model)
 {
     return(new StateMachine <AccountStates, AccountTriggers>(ExtractState(model)));
 }
Example #2
0
 protected override void SetModelState(AccountStates state, IAccountDataModel model)
 {
     // todo : update model properties to reflect the state
     throw new NotImplementedException();
 }
Example #3
0
 /// <summary>
 /// Tries the set the model to "complete" state.
 /// </summary>
 public bool TrySetComplete(IAccountDataModel model, List <IModelError> errors, IModelContext context = null)
 {
     return(TryUpdateItemState(model, AccountTriggers.Complete, errors, context));
 }
Example #4
0
        // Add new methods to represent other states //

        protected override AccountStates ExtractState(IAccountDataModel model)
        {
            // todo : extract a AccountStates to repersent the current model
            throw new NotImplementedException();
        }
 /// <summary>
 /// Tries to save the item.
 /// </summary>
 /// <param name="item"></param>
 /// <param name="errors"></param>
 /// <param name="context"></param>
 /// <returns></returns>
 public bool TrySave(IAccountDataModel item, List <IModelError> errors, IModelContext context = null)
 {
     return(item.IsNew ?
            TryCreate(item, errors, context) :
            TryUpdate(item, errors, context));
 }