Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        public IHttpActionResult GetApprovalDelegationHeader(int id)
        {
            ApprovalDelegationHeader approvalDelegationHeader = db.ApprovalDelegationHeaders.Find(id);

            if (approvalDelegationHeader == null)
            {
                return(NotFound());
            }

            return(Ok(approvalDelegationHeader));
        }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
        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));
        }