public Object GetResponse(Charge charge, Asset asset, bool creation)
 {
     return new
     {
         dto = charge,
         message = creation ? "Charge added":"Charge updated"
     };
 }
 private Object GetReturnSaveReturnDto(Asset asset)
 {
     var returnValue = new
     {
         asset = asset,
         message = "Saved OK"
     };
     return returnValue;
 }
        // POST api/assets
        public Object Post(Asset value)
        {
            var owner = ObtainCurrentOwner();

            value.OwnerId = owner.Id;
            RavenSession.Store(value);

            return GetReturnSaveReturnDto(value);
        }
Example #4
0
        public static IEnumerable<Asset> GetAssets()
        {
            var asset = new Asset
            {
                Id = 2,
                OwnerId = 1,
                Address = "Test",
                Charges = new List<Charge>() {
                    new Charge { AccountNumber = "111", Id = 1}
                }
            };

            return new List<Asset>{asset};
        }
        // PUT api/assets/5
        public Object Put(int id, Asset value)
        {
            var owner = ObtainCurrentOwner();
            var asset = GetAsset(id, owner);

            asset.Name = value.Name;
            asset.ZipCode = value.ZipCode;
            asset.City = value.City;
            asset.Address = value.Address;
            asset.Size = value.Size;
            asset.PMS = value.PMS;
            asset.Price = value.Price;
            asset.ZipCode = value.ZipCode;
            asset.Country = value.Country;
            asset.IncomeTax = value.IncomeTax;
            asset.InterestRate = value.InterestRate;
            asset.Latitude = value.Latitude;
            asset.Longitude = value.Longitude;

            return GetReturnSaveReturnDto(asset);
        }