public async Task <IActionResult> PuttblUserSessions([FromRoute] int id, [FromBody] tblUserSessions tblUserSessions) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tblUserSessions.UserID) { return(BadRequest()); } _context.Entry(tblUserSessions).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!tblUserSessionsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public virtual async Task AddAsync(T entity) { EntityEntry dbEntityEntry = _context.Entry <T>(entity); await _context.Set <T>().AddAsync(entity); }