Example #1
0
        public IPutResponse UpdateAsset([FromUri] int id, [FromBody] AssetModel model)
        {
            int count = 0;

            if (id > 0)
            {
                count = Asset.Update(id, model.ToInterface());
            }

            return(new PutResponse()
            {
                AffectedRecords = count
            });
        }
Example #2
0
        public IPostResponse InsertAsset([FromBody] AssetModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("Please provide a asset to insert.");
            }

            if (model.Id > 0)
            {
                throw new System.ArgumentException("The Asset cannot have an Id.  If you'd like to update an Asset, call update method.");
            }

            return(Asset.Insert(model.ToInterface()));
        }