コード例 #1
0
        public IHttpActionResult PutApprovalProcessType(int id, ApprovalProcessType approvalProcessType)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != approvalProcessType.ApprovalProcessId)
            {
                return BadRequest();
            }

            db.Entry(approvalProcessType).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ApprovalProcessTypeExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
コード例 #2
0
        public IHttpActionResult PostApprovalProcessType(ApprovalProcessType approvalProcessType)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.ApprovalProcessTypes.Add(approvalProcessType);
            db.SaveChanges();

            return CreatedAtRoute("DefaultApi", new { id = approvalProcessType.ApprovalProcessId }, approvalProcessType);
        }