Exemplo n.º 1
0
        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
                });
            }));
        }
Exemplo n.º 2
0
        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));
            }));
        }