Example #1
0
        private Person <User> GetPerson(IService <Person <User> > personService,
                                        MapperProfile <PersonModel, Person <User> > userProfile,
                                        PersonModel value)
        {
            var entity = this._personService.GetData(e =>
                                                     (e.User.Login.Equals(value.UserInfo.UserName) ||
                                                      e.User.Email.Equals(value.UserInfo.UserEmail))
                                                     ).FirstOrDefault();

            // Only one account by email or username
            if (entity != null)
            {
                return(null);
            }

            entity = userProfile.Map(value);

            entity.Id        = Guid.NewGuid();
            entity.AccountId = entity.Id;

            return(entity);
        }