// GET api/TipoEmpleadoDist/5 public IHttpActionResult Get(int id) { TipoEmpleadoDist tedInDB = _context.TipoEmpleadoDists.FirstOrDefault(d => d.Id == id); if (tedInDB == null) { return(NotFound()); } return(Ok(tedInDB)); }
public IHttpActionResult Post([FromBody] TipoEmpleadoDist tipoEmpleadoDist) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } tipoEmpleadoDist.Id = TipoEmpleadoDist.GetNextId(_context); _context.TipoEmpleadoDists.Add(tipoEmpleadoDist); _context.SaveChanges(); return(Created(new Uri(Request.RequestUri + "/" + tipoEmpleadoDist.Id), tipoEmpleadoDist)); }
public IHttpActionResult Put(int id, [FromBody] TipoEmpleadoDist tipoEmpleadoDist) { if (!ModelState.IsValid) { return(BadRequest()); } TipoEmpleadoDist tedInDB = _context.TipoEmpleadoDists.FirstOrDefault(d => d.Id == id); if (tedInDB == null) { return(NotFound()); } tedInDB.GrupoContableId = tipoEmpleadoDist.GrupoContableId; tedInDB.Name = tipoEmpleadoDist.Name; tedInDB.Description = tipoEmpleadoDist.Description; _context.SaveChanges(); return(Ok(tedInDB)); }