public async Task <IActionResult> PutTmanufacturer(long id, Tmanufacturer tmanufacturer) { if (id != tmanufacturer.TmanufacturerId) { return(BadRequest()); } _context.Entry(tmanufacturer).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TmanufacturerExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Tmanufacturer> > PostTmanufacturer(Tmanufacturer tmanufacturer) { _context.Tmanufacturer.Add(tmanufacturer); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (TmanufacturerExists(tmanufacturer.TmanufacturerId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetTmanufacturer", new { id = tmanufacturer.TmanufacturerId }, tmanufacturer)); }