예제 #1
0
        public IActionResult saveTokenLogs([FromBody] TokenLogs tokenLog)
        {
            try
            {
                tokenLog.createdat = DateTime.Now;
                _csxContext.TokenLogs.Add(tokenLog);
                _csxContext.SaveChanges();

                return(Ok(tokenLog));
            }
            catch (System.Exception ex)
            {
                return(NotFound("Erro ao Salvar: " + ex.Message));
            }
        }
예제 #2
0
        public async Task <TokenLogs> Save(Tokens token, TokenLogs log)
        {
            try
            {
                log.createdat = DateTime.Now;
                _csxContext.TokenLogs.Add(log);
                //Update hits
                token.hits++;
                _csxContext.Tokens.Update(token);
                await _csxContext.SaveChangesAsync();

                return(log);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }