Exemplo n.º 1
0
        public IActionResult Login(PeopleLoginDto peopleLoginDto)
        {
            var adminUserBo = _boProvider.GetAdminUserBo();
            var result      = adminUserBo.Login(peopleLoginDto);

            return(Ok(result));
        }
 /// <summary>
 /// 用户登录
 /// </summary>
 /// <param name="peopleLoginDto"></param>
 /// <returns></returns>
 internal object Login(PeopleLoginDto peopleLoginDto)
 {
     if (peopleLoginDto.NetName.IsNullOrEmpty() || peopleLoginDto.Password.IsNullOrEmpty())
     {
         return(JsonConvert.SerializeObject(new ResultMsgDto()
         {
             Code = 400, Msg = $"用户名和密码不能为空"
         }));
     }
     else
     {
         var result = _boProvider._peopleRepo.Login(peopleLoginDto);
         return(result);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="peopleLoginDto"></param>
        /// <returns></returns>
        internal object Login(PeopleLoginDto peopleLoginDto)
        {
            var result = _context.Peoples.Any(m => m.NetName == peopleLoginDto.NetName && m.Password == peopleLoginDto.Password);

            if (result)
            {
                var peopleId = _context.Peoples.Where(m => m.NetName == peopleLoginDto.NetName && m.Password == peopleLoginDto.Password).Select(r => r.Id).First();
                return(peopleId);
            }
            else
            {
                return(JsonConvert.SerializeObject(new ResultMsgDto()
                {
                    Code = 500, Msg = $"用户名或密码输入不正确"
                }));
            }
        }