public async Task <IActionResult> PutDcandidate(int id, Dcandidate dcandidate) { //if (id != dcandidate.Id) //{ // return BadRequest(); //} dcandidate.Id = id; _context.Entry(dcandidate).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DcandidateExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public IHttpActionResult PutEmployee(int id, Employee employee) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != employee.EmployeeID) { 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 void Create(T Entity) { _employeeDB.Entry(Entity).State = EntityState.Added; }
public HttpResponseMessage Put(int id, [FromBody] TblEmployee value) { EmployeeDB.Entry(value).State = EntityState.Modified; return(ToJson(EmployeeDB.SaveChanges())); }