示例#1
0
        public ActionResult LoginReq([FromBody] User login)
        {
            Console.WriteLine(login.Username + login.Password);
            if (_userService.GetByUsername(login.Username) == null)
            {
                return(StatusCode(404, "User doesn't exists!"));
            }
            User user = _userService.GetByUsername(login.Username);

            if (user.Password != login.Password)
            {
                return(StatusCode(401, "Wrong password or username"));
            }
            user.Password = null;
            Statistics stats = _statsService.GetByUsername(user.Username);

            return(Ok(new { User = user, Stats = stats }));
        }
 public ActionResult <Statistics> GetByUsername(string username)
 {
     return(_statsService.GetByUsername(username));
 }