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

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

            return GetReturnSaveReturnDto(value);
        }
コード例 #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};
        }
コード例 #5
0
        // 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);
        }