public object Delete(Guid asset_id) { return(base.ExecuteFunction("Delete", delegate() { dm.Asset delete = this.API.Direct.Assets.GetById(asset_id); this.API.Direct.Assets.Delete(asset_id); return Http200(new ActionResult() { success = true, message = asset_id.ToString() }); })); }
public object GetById(Guid asset_id) { return(base.ExecuteFunction <object>("GetById", delegate() { dm.Asset result = this.API.Direct.Assets.GetById(asset_id); if (result == null) { return Http404("Asset"); } return base.Http200(new ItemResult <sdk.Asset>() { success = true, item = result.ToSDKModel() }); })); }
public object Update(Guid asset_id, sdk.Asset asset) { return(base.ExecuteFunction <object>("Update", delegate() { this.ValidateNotNull(asset, "Asset"); this.ValidateRouteMatch(asset_id, asset.asset_id, "Asset"); asset.asset_id = asset_id; dm.Asset update = asset.ToDomainModel(); update = this.API.Direct.Assets.Update(update); sdk.Asset existing = this.API.Direct.Assets.GetById(update.asset_id).ToSDKModel(); return base.Http200(new ItemResult <sdk.Asset>() { success = true, item = existing }); })); }
public object Create(sdk.Asset asset) { return(base.ExecuteFunction <object>("Create", delegate() { this.ValidateNotNull(asset, "Asset"); dm.Asset insert = asset.ToDomainModel(); insert = this.API.Direct.Assets.Insert(insert); sdk.Asset result = insert.ToSDKModel(); return base.Http201(new ItemResult <sdk.Asset>() { success = true, item = result } , string.Format("api/asset/{0}", asset.asset_id)); })); }