Esempio n. 1
0
        public async Task <IDataResult <long> > AddAsync(AddUserModel addUserModel)
        {
            var validation = new AddUserModelValidator().Valid(addUserModel);

            if (!validation.Success)
            {
                return(new ErrorDataResult <long>(validation.Message));
            }

            addUserModel.SignIn = UserDomainService.CreateSignIn(addUserModel.SignIn);

            var userEntity = UserEntityFactory.Create(addUserModel);

            userEntity.Add();

            await UserRepository.AddAsync(userEntity);

            await UnitOfWork.SaveChangesAsync();

            return(new SuccessDataResult <long>(userEntity.UserId));
        }