public IHttpActionResult PostNATIONALITIES(NATIONALITIES nATIONALITIES) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.NATIONALITIES.Add(nATIONALITIES); try { db.SaveChanges(); } catch (DbUpdateException) { if (NATIONALITIESExists(nATIONALITIES.NATIONALITY_ID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = nATIONALITIES.NATIONALITY_ID }, nATIONALITIES)); }
public IHttpActionResult PutNATIONALITIES(short id, NATIONALITIES nATIONALITIES) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != nATIONALITIES.NATIONALITY_ID) { return(BadRequest()); } db.Entry(nATIONALITIES).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!NATIONALITIESExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetNATIONALITIES(short id) { NATIONALITIES nATIONALITIES = db.NATIONALITIES.Find(id); if (nATIONALITIES == null) { return(NotFound()); } return(Ok(nATIONALITIES)); }
public IHttpActionResult DeleteNATIONALITIES(short id) { NATIONALITIES nATIONALITIES = db.NATIONALITIES.Find(id); if (nATIONALITIES == null) { return(NotFound()); } db.NATIONALITIES.Remove(nATIONALITIES); db.SaveChanges(); return(Ok(nATIONALITIES)); }