public async Task <IActionResult> PutUloge([FromRoute] int id, [FromBody] Uloge uloge) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != uloge.UlogaId) { return(BadRequest()); } _context.Entry(uloge).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UlogeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <T> AddAsync(T entity) { _ctx.Set <T>().Add(entity); await _ctx.SaveChangesAsync(); return(entity); }