/// <summary> /// Gets the state machine. /// </summary> protected virtual StateMachine <AccountStates, AccountTriggers> GetStateMachine(IAccountDataModel model) { return(new StateMachine <AccountStates, AccountTriggers>(ExtractState(model))); }
protected override void SetModelState(AccountStates state, IAccountDataModel model) { // todo : update model properties to reflect the state throw new NotImplementedException(); }
/// <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)); }
// 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)); }