public IHttpActionResult PostLicenseeSub(LicenseeSub licenseeSub) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.LicenseeSubs.Add(licenseeSub); try { db.SaveChanges(); } catch (DbUpdateException) { if (LicenseeSubExists(licenseeSub.LicenseeSubType)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = licenseeSub.LicenseeSubType }, licenseeSub)); }
public IHttpActionResult PutLicenseeSub(string id, LicenseeSub licenseeSub) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != licenseeSub.LicenseeSubType) { return(BadRequest()); } db.Entry(licenseeSub).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!LicenseeSubExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetLicenseeSub(string id) { LicenseeSub licenseeSub = db.LicenseeSubs.Find(id); if (licenseeSub == null) { return(NotFound()); } return(Ok(licenseeSub)); }
public IHttpActionResult DeleteLicenseeSub(string id) { LicenseeSub licenseeSub = db.LicenseeSubs.Find(id); if (licenseeSub == null) { return(NotFound()); } db.LicenseeSubs.Remove(licenseeSub); db.SaveChanges(); return(Ok(licenseeSub)); }