public void PutPerson(int id, Person person) { if (id == person.PersonID) { db.Entry(person).State = EntityState.Modified; db.SaveChanges(); } }
public IHttpActionResult PutDepartament(int id, Department departament) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != departament.Id) { return(BadRequest()); } db.Entry(departament).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DepartamentExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutEmployee(int id, Employee employee) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != employee.Id) { return(BadRequest()); } db.Entry(employee).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task UpdateClientAsync(Client client) { _context.Entry(client).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } }
public async Task UpdatePersonAsync(Person person) { _context.Entry(person).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } }
public async Task UpdateRoleAsync(Role role) { _context.Entry(role).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } }
public async Task UpdateTermAsync(Term term) { _context.Entry(term).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } }
public async Task UpdateWorkerAsync(Worker worker) { _context.Entry(worker).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } }
public async Task ChangePasswordAsync(int loginId, string newPassword) { var login = await GetLoginAsync(loginId); login.Password = newPassword; _context.Entry(login).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } }