public IHttpActionResult Post(EBaseSize eBaseSize) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.EBaseSizes.Add(eBaseSize); try { db.SaveChanges(); } catch (DbUpdateException) { if (EBaseSizeExists(eBaseSize.base_requirement_id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = eBaseSize.base_requirement_id }, eBaseSize)); }
public IHttpActionResult Put(int id, EBaseSize eBaseSize) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != eBaseSize.base_requirement_id) { return(BadRequest()); } db.Entry(eBaseSize).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EBaseSizeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Get(int id) { EBaseSize eBaseSize = db.EBaseSizes.Find(id); if (eBaseSize == null) { return(NotFound()); } return(Ok(eBaseSize)); }
public IHttpActionResult Delete(int id) { EBaseSize eBaseSize = db.EBaseSizes.Find(id); if (eBaseSize == null) { return(NotFound()); } db.EBaseSizes.Remove(eBaseSize); db.SaveChanges(); return(Ok(eBaseSize)); }