Esempio n. 1
0
        public async Task <IActionResult> Login([FromBody] AuthModels.Login login)
        {
            // login
            var res = await Authservice.Login(login.Username, login.Password);

            if (res.Success)
            {
                // set auth key for session
                SetAuth(res.UserId, res.AuthKey);

                // return to listing screen on login
                return(SuccessResponse("/employee/listing"));
            }

            // return error
            return(ErrorResponse(res.Errors));
        }