public async Task <ActionResult <TurnoException> > Post( [FromServices] DataContext context, [FromBody] TurnoException model) { try { if (ModelState.IsValid) { context.MD_TURNO_EXCEPTION.Add(model); await context.SaveChangesAsync(); return(model); } else { return(BadRequest(ModelState)); } } catch (System.Exception ex) { return(StatusCode(500, ex.Message)); } }
public async Task <ActionResult> Put([FromServices] DataContext context, [FromBody] TurnoException model, long id) { if (id != model.EXC_ID) { return(BadRequest()); } try { if (ModelState.IsValid) { context.Update(model); await context.SaveChangesAsync(); return(Ok(model)); } else { return(BadRequest(ModelState)); } } catch (System.Exception ex) { return(StatusCode(500, ex.Message)); } }