public IHttpActionResult PuttblAssetType(int id, tblAssetType tblAssetType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tblAssetType.assetTypeId) { return(BadRequest()); } db.Entry(tblAssetType).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!tblAssetTypeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GettblAssetType(int id) { tblAssetType tblAssetType = db.tblAssetTypes.Find(id); if (tblAssetType == null) { return(NotFound()); } return(Ok(tblAssetType)); }
public IHttpActionResult PosttblAssetType(tblAssetType tblAssetType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tblAssetTypes.Add(tblAssetType); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = tblAssetType.assetTypeId }, tblAssetType)); }
public object AddAssetType(string AssetTypeName) { var DC = new DataClassesDataContext(); tblAssetType AssetTypeObj = new tblAssetType(); AssetTypeObj.AssetTypeName = AssetTypeName; DC.tblAssetTypes.InsertOnSubmit(AssetTypeObj); DC.SubmitChanges(); return(true); }
public IHttpActionResult DeletetblAssetType(int id) { tblAssetType tblAssetType = db.tblAssetTypes.Find(id); if (tblAssetType == null) { return(NotFound()); } db.tblAssetTypes.Remove(tblAssetType); db.SaveChanges(); return(Ok(tblAssetType)); }