public IHttpActionResult PutApprovalDelegationHeader(int id, ApprovalDelegationHeader approvalDelegationHeader) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != approvalDelegationHeader.Id) { return(BadRequest()); } db.Entry(approvalDelegationHeader).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ApprovalDelegationHeaderExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetApprovalDelegationHeader(int id) { ApprovalDelegationHeader approvalDelegationHeader = db.ApprovalDelegationHeaders.Find(id); if (approvalDelegationHeader == null) { return(NotFound()); } return(Ok(approvalDelegationHeader)); }
public IHttpActionResult PostApprovalDelegationHeader(ApprovalDelegationHeader approvalDelegationHeader) { //if (!ModelState.IsValid) //{ // return BadRequest(ModelState); //} db.ApprovalDelegationHeaders.Add(approvalDelegationHeader); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = approvalDelegationHeader.Id }, approvalDelegationHeader)); }
public IHttpActionResult DeleteApprovalDelegationHeader(int id) { ApprovalDelegationHeader approvalDelegationHeader = db.ApprovalDelegationHeaders.Find(id); if (approvalDelegationHeader == null) { return(NotFound()); } db.ApprovalDelegationHeaders.Remove(approvalDelegationHeader); db.SaveChanges(); return(Ok(approvalDelegationHeader)); }