public async Task <IHttpActionResult> PutPersonal(int id, Personal personal) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != personal.Id) { return(BadRequest()); } db.Entry(personal).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersonalExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task UpdateAsync(T entity) { _dbContext.Entry(entity).State = EntityState.Modified; await _dbContext.SaveChangesAsync(); }