Beispiel #1
0
        public async Task <User> CreateUserAsync(User user)
        {
            if (!_ZoneDB.Users.Any(u => u.Email == user.Email))
            {
                user.UserID = Guid.NewGuid();
                _ZoneDB.Add(user);
                await _ZoneDB.SaveChangesAsync();

                user.Password = null;
                user.Email    = null;
                return(user);
            }
            else
            {
                throw new ArgumentException("User Email should be unique");
            }
        }