public IHttpActionResult PutRegisterApplicant(int id, RegisterApplicant registerApplicant) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != registerApplicant.RegisterApplicantId) { return(BadRequest()); } db.Entry(registerApplicant).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!RegisterApplicantExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetRegisterApplicant(int id) { RegisterApplicant registerApplicant = db.RegisterApplicants.Find(id); if (registerApplicant == null) { return(NotFound()); } return(Ok(registerApplicant)); }
public IHttpActionResult PostRegisterApplicant(RegisterApplicant registerApplicant) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.RegisterApplicants.Add(registerApplicant); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = registerApplicant.RegisterApplicantId }, registerApplicant)); }
public IHttpActionResult DeleteRegisterApplicant(int id) { RegisterApplicant registerApplicant = db.RegisterApplicants.Find(id); if (registerApplicant == null) { return(NotFound()); } db.RegisterApplicants.Remove(registerApplicant); db.SaveChanges(); return(Ok(registerApplicant)); }