public async Task<IHttpActionResult> PutFacingType(int id, FacingType facingType) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != facingType.Id) { return BadRequest(); } db.Entry(facingType).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FacingTypeExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public async Task<IHttpActionResult> PostFacingType(FacingType facingType) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.FacingTypes.Add(facingType); await db.SaveChangesAsync(); return CreatedAtRoute("DefaultApi", new { id = facingType.Id }, facingType); }