public async Task <IActionResult> PutSmartWatchSession([FromRoute] Guid id, [FromBody] SmartWatchSession smartWatchSession) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != smartWatchSession.SmartWatchSessionId) { return(BadRequest()); } _context.Entry(smartWatchSession).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SmartWatchSessionExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostSmartWatchSession([FromBody] SmartWatchSession smartWatchSession) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.SmartWatchSessions.Add(smartWatchSession); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSmartWatchSession", new { id = smartWatchSession.SmartWatchSessionId }, smartWatchSession)); }