public IHttpActionResult PostEmailType(EmailType emailType) { if (!ModelState.IsValid) { return BadRequest(ModelState); } _genericService.AddOrUpdate<EmailType>(emailType); return CreatedAtRoute("DefaultApi", new { id = emailType.Id }, emailType); }
public IHttpActionResult PutEmailType(int id, EmailType emailType) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != emailType.Id) { return BadRequest(); } if (!EmailTypeExists(id)) { return NotFound(); } else { _genericService.AddOrUpdate<EmailType>(emailType); } return StatusCode(HttpStatusCode.NoContent); }