예제 #1
0
        /// <summary>
        /// IsExistsAsync
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public async Task <bool> IsExistsAsync(int userId, XM.UserStatus?status = null)
        {
            var query = _context.User.Where(m => m.UserId == userId);

            query = query.WhereIf(status.HasValue, m => m.Status == status);
            return(await query.AnyAsync());
        }
예제 #2
0
        /// <summary>
        /// GetItemByUsernameAsync
        /// </summary>
        /// <param name="username"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public async Task <XM.UserInfo> GetItemByUsernameAsync(string username, XM.UserStatus?status = null)
        {
            var query = _context.User.AsNoTracking().Where(m => m.Username == username);

            query.WhereIf(status.HasValue, m => m.Status == status.Value);
            var user = await query.Select(_selector).FirstOrDefaultAsync();

            return(user);
        }
예제 #3
0
 /// <summary>
 /// IsExistsAsync
 /// </summary>
 /// <param name="userId"></param>
 /// <param name="status"></param>
 /// <returns></returns>
 public async Task <bool> IsExistsAsync(int userId, XM.UserStatus?status = null)
 {
     if (status.HasValue)
     {
         return(await _context.User.AnyAsync(m => m.UserId == userId && m.Status == status));
     }
     else
     {
         return(await _context.User.AnyAsync(m => m.UserId == userId));
     }
 }
예제 #4
0
 /// <summary>
 /// GetItemByUserIdAsync
 /// </summary>
 /// <param name="userId"></param>
 /// <param name="status"></param>
 /// <returns></returns>
 public async Task <XM.UserInfo> GetItemByUserIdAsync(int userId, XM.UserStatus?status = null)
 {
     XM.UserInfo user;
     if (status.HasValue)
     {
         user = await _context.User.AsNoTracking().Select(_selector).FirstOrDefaultAsync(m => m.UserId == userId && m.Status == status.Value);
     }
     else
     {
         user = await _context.User.AsNoTracking().Select(_selector).FirstOrDefaultAsync(m => m.UserId == userId);
     }
     return(user);
 }
예제 #5
0
        public async Task <XM.UserInfo> GetItemByUsernameAsync(string username, XM.UserStatus?status = null)
        {
            XM.UserInfo user;
            if (status.HasValue)
            {
                user = await _tubumuContext.User.AsNoTracking().Select(_selector).FirstOrDefaultAsync(m => m.Username == username && m.Status == status.Value);
            }
            else
            {
                user = await _tubumuContext.User.AsNoTracking().Select(_selector).FirstOrDefaultAsync(m => m.Username == username);
            }

            return(user);
        }
예제 #6
0
 /// <summary>
 /// GetItemByMobileAsync
 /// </summary>
 /// <param name="mobile"></param>
 /// <param name="mobileIsValid"></param>
 /// <param name="status"></param>
 /// <returns></returns>
 public async Task <XM.UserInfo> GetItemByMobileAsync(string mobile, bool mobileIsValid = true, XM.UserStatus?status = null)
 {
     XM.UserInfo user;
     if (status.HasValue)
     {
         user = await _context.User.AsNoTracking().Select(_selector).FirstOrDefaultAsync(m => (m.EmailIsValid == mobileIsValid && m.Mobile == mobile) && m.Status == status.Value);
     }
     else
     {
         user = await _context.User.AsNoTracking().Select(_selector).FirstOrDefaultAsync(m => (m.EmailIsValid == mobileIsValid && m.Mobile == mobile));
     }
     return(user);
 }
예제 #7
0
        /// <summary>
        /// GetItemByMobileAsync
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="mobileIsValid"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public async Task <XM.UserInfo> GetItemByMobileAsync(string mobile, bool?mobileIsValid, XM.UserStatus?status = null)
        {
            var query = _context.User.AsNoTracking().Where(m => m.Mobile == mobile);

            query.WhereIf(mobileIsValid.HasValue, m => m.MobileIsValid == mobileIsValid.Value);
            query.WhereIf(status.HasValue, m => m.Status == status.Value);
            var user = await query.Select(_selector).FirstOrDefaultAsync();

            return(user);
        }
예제 #8
0
        /// <summary>
        /// GetItemByEmailAsync
        /// </summary>
        /// <param name="email"></param>
        /// <param name="emailIsValid"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public async Task <XM.UserInfo> GetItemByEmailAsync(string email, bool?emailIsValid, XM.UserStatus?status = null)
        {
            var query = _context.User.AsNoTracking().Where(m => m.Email == email);

            query.WhereIf(emailIsValid.HasValue, m => m.EmailIsValid == emailIsValid.Value);
            query.WhereIf(status.HasValue, m => m.Status == status.Value);
            var user = await query.Select(_selector).FirstOrDefaultAsync();

            return(user);
        }
예제 #9
0
 public async Task <XM.UserInfo> GetItemByEmailAsync(string email, bool emailIsValid = true, XM.UserStatus?status = null)
 {
     XM.UserInfo user;
     if (status.HasValue)
     {
         user = await _tubumuContext.User.AsNoTracking().Select(_selector).FirstOrDefaultAsync(m => (m.EmailIsValid == emailIsValid && m.Email == email) && m.Status == status.Value);
     }
     else
     {
         user = await _tubumuContext.User.AsNoTracking().Select(_selector).FirstOrDefaultAsync(m => (m.EmailIsValid == emailIsValid && m.Email == email));
     }
     return(user);
 }