public async Task <IActionResult> PutTloadSwitch(byte id, TloadSwitch tloadSwitch) { if (id != tloadSwitch.TloadSwitchId) { return(BadRequest()); } _context.Entry(tloadSwitch).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TloadSwitchExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <TloadSwitch> > PostTloadSwitch(TloadSwitch tloadSwitch) { _context.TloadSwitch.Add(tloadSwitch); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (TloadSwitchExists(tloadSwitch.TloadSwitchId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetTloadSwitch", new { id = tloadSwitch.TloadSwitchId }, tloadSwitch)); }