Пример #1
0
        public async Task <ActionResult> GenToken([FromBody] Usuario usuario)

        {
            if (!ModelState.IsValid)
            {
                return(handleErr());
            }

            Usuario resultado = await _dataService.CheckUserLogin(usuario);

            if (resultado != null)
            {
                return(new JsonResult(new { token = GenerateJwtToken(resultado) }));
            }
            else
            {
                _loggerService.recordLogError(_loggerService.GetLastMethodName(), "Unauthorized", usuario.usuario);
                return(Unauthorized());
            }
        }
Пример #2
0
        public async Task <List <Checkpoint> > GetCheckpointAsync()
        {
            string query = "SELECT * FROM EventosDev;";

            try
            {
                using (_conn = new MySqlConnection(_conString))
                {
                    var result = await _conn.QueryAsync <Checkpoint>(query);

                    return(result.ToList());
                }
            }
            catch (Exception ex)
            {
                _loggerService.recordLogError(_loggerService.GetLastMethodName(), ex.Message, "GetCheckPointAsync");
            }

            return(null);
        }