Пример #1
0
        public async Task <IActionResult> PutLog_Auditoria([FromRoute] int id, [FromBody] Log_Auditoria log_Auditoria)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != log_Auditoria.id)
            {
                return(BadRequest());
            }

            _context.Entry(log_Auditoria).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Log_AuditoriaExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #2
0
        public async Task <IActionResult> PostLog_Auditoria([FromBody] Log_Auditoria log_Auditoria)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Log_Auditoria.Add(log_Auditoria);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetLog_Auditoria", new { id = log_Auditoria.id }, log_Auditoria));
        }