Exemplo n.º 1
0
        // PUT api/DevStatus/5
        public async Task<IHttpActionResult> PutDevelopmentStatus(int id, DevelopmentStatus developmentstatus)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != developmentstatus.Id)
            {
                return BadRequest();
            }

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

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DevelopmentStatusExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
Exemplo n.º 2
0
        public async Task<IHttpActionResult> PostDevelopmentStatus(DevelopmentStatus developmentstatus)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.DevelopmentStatus.Add(developmentstatus);
            await db.SaveChangesAsync();

            return CreatedAtRoute("DefaultApi", new { id = developmentstatus.Id }, developmentstatus);
        }