/// <summary> /// Tries to create a new item /// </summary> /// <param name="item">The item.</param> /// <param name="errors">The errors.</param> /// <param name="context">The context.</param> /// <returns></returns> /// <exception cref="InvalidOperationException">Unable to update IAccountDataModel"</exception> private bool TryCreate(IAccountDataModel item, List <IModelError> errors, IModelContext context = null) { if (TryValidateModel(item, Operation.Create, errors, context) == false) { return(false); } if (item != null && item.Password != null) { item.Password = cryptoProvider.CreateHash(item.Password); } try { changeHandler.BeforeCreate(item, context); dal.Create(item, context); changeHandler.AfterCreate(item, context); } catch (Exception ex) { log.Exception(LogName, ex); throw new InvalidOperationException("Unable to create IAccountDataModel", ex); } return(true); }
public void Create(Account entity) { _AccountDal.Create(entity); }