public IHttpActionResult PutassetType(int id, assetType assetType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != assetType.at_id) { return(BadRequest()); } db.Entry(assetType).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!assetTypeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetassetType(int id) { assetType assetType = db.assetTypes.Find(id); if (assetType == null) { return(NotFound()); } return(Ok(assetType)); }
public IHttpActionResult PostassetType(assetType assetType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.assetTypes.Add(assetType); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = assetType.at_id }, assetType)); }
public IHttpActionResult DeleteassetType(int id) { assetType assetType = db.assetTypes.Find(id); if (assetType == null) { return(NotFound()); } db.assetTypes.Remove(assetType); db.SaveChanges(); return(Ok(assetType)); }
select(assetType, assetId)) .ToLookup(x => x.assetType, x => x.assetId);