public async Task <IActionResult> PutDataField(int id, DataField dataField) { if (id != dataField.Id) { return(BadRequest()); } _context.Entry(dataField).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DataFieldExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutObject(int id, Object @object) { if (id != @object.Id) { return(BadRequest()); } _context.Entry(@object).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ObjectExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <bool> Create(Building building) { _context.Add(building); await _context.SaveChangesAsync(); return(true); }
public async Task <IActionResult> PutReading(int id, Reading reading) { if (id != reading.Id) { return(BadRequest()); } _context.Entry(reading).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ReadingExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }