public IHttpActionResult PostAddressType(AddressType addressType) { if (!ModelState.IsValid) { return BadRequest(ModelState); } _genericService.AddOrUpdate<AddressType>(addressType); return CreatedAtRoute("DefaultApi", new { id = addressType.Id }, addressType); }
public IHttpActionResult PutAddressType(int id, AddressType addressType) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != addressType.Id) { return BadRequest(); } //db.Entry(addressType).State = EntityState.Modified; //_genericService.AddOrUpdate<AddressType>(addressType); if (!AddressTypeExists(id)) { return NotFound(); } else { _genericService.AddOrUpdate<AddressType>(addressType); } return StatusCode(HttpStatusCode.NoContent); }