public async Task <IActionResult> PutTipoMat(string id, TipoMat TipoMat) { if (id != TipoMat.TIPO) { return(BadRequest()); } _context.Entry(TipoMat).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TipoMatExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <TipoMat> > PostTipoMat(TipoMat TipoMat) { _context.TipoMat.Add(TipoMat); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (TipoMatExists(TipoMat.TIPO)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetTipoMat", new { id = TipoMat.TIPO }, TipoMat)); }