示例#1
0
        public User CreateUser(string userName)
        {
            var user = new User
            {
                UserName = userName
            };

            _context.Users.Add(user);

            return(user);
        }
示例#2
0
        public async Task <User> CreateUserAsync(string userName)
        {
            var user = new User
            {
                UserName = userName
            };

            _ = await _context.Users.AddAsync(user);

            return(user);
        }
示例#3
0
        public async Task <PhotoUser> CreatePhotoUserAsync(Photo photo, User user)
        {
            var photoUser = new PhotoUser
            {
                Photo = photo,
                User  = user
            };

            await _context.PhotoUsers.AddAsync(photoUser);

            return(photoUser);
        }
示例#4
0
        public PhotoUser CreatePhotoUser(Photo photo, User user)
        {
            var photoUser = new PhotoUser
            {
                Photo = photo,
                User  = user
            };

            _context.PhotoUsers.Add(photoUser);

            return(photoUser);
        }
示例#5
0
 public bool ExistsUserByUserName(string userName, out User user)
 {
     user = _context.Users.FirstOrDefault(u => u.UserName == userName);
     return(user != null);
 }