public async Task <IActionResult> PutBarbearia([FromRoute] int id, [FromBody] Barbearia barbearia) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != barbearia.IdBarbearia) { return(BadRequest()); } _context.Entry(barbearia).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BarbeariaExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutAcObject([FromRoute] int id, [FromBody] AcObject acObject) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != acObject.ObjId) { return(BadRequest()); } _context.Entry(acObject).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AcObjectExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutCortePorBarbeiro([FromRoute] int id, [FromBody] CortePorBarbeiro cortePorBarbeiro) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != cortePorBarbeiro.CorteIdCorte) { return(BadRequest()); } _context.Entry(cortePorBarbeiro).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CortePorBarbeiroExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutItems([FromRoute] string id, [FromBody] Items items) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != items.Itemcode) { return(BadRequest()); } _context.Entry(items).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ItemsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <Custom> UpdateCustom(Custom custom, int id) { try { custom.Id = id; context.Entry(custom).State = EntityState.Modified; await context.SaveChangesAsync(); } catch (Exception) { return(null); } return(custom); }