Example #1
0
        public async Task <ActionResult> Login([FromBody] LoginViewModel loginModel)
        {
            var loginResult = await signInService.LoginUser(loginModel);

            if (!loginResult.IsValid)
            {
                return(BadRequest(loginResult.Errors));
            }

            return(Ok(
                       new
            {
                token = loginResult.Token,
                roles = loginResult.Roles.ToArray(),
                name = loginResult.Name
            }));
        }