public IActionResult Register() { var form = HttpContext.Request.Form; var username = form["login"]; var password = form["password"]; _userService.Add(username, password, Roles.Junior); Ok(new { login = username, token = $"Bearer {_tokenService.GetToken(username)}" }); return(View("~/Views/Home/Index.cshtml")); }
public IActionResult Add(User user) { _userService.Add(user.Login, user.Password, user.Role); return(Ok()); }