Exemplo n.º 1
0
        public ActionResult CreateRealEstate(RealEstateAssetData model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    AssetQuoter quoter = new AssetQuoter(new ZillowClient(), new YahooFinanceClient()); //TODO setup ninject to inject these automatically
                    model.Asset.Symbol = quoter.GetPropertyId(model.Address, model.City, model.State, model.Zip);
                }
                catch (ZillowPropertyNotFoundException)
                {
                    ModelState.AddModelError(string.Empty, "Property not found on Zillow");
                }
            }

            if (ModelState.IsValid)
            {
                repository.AddRealEstateAssetData(model);
                return RedirectToAction("RealEstate");
            }

            return View(model);
        }
Exemplo n.º 2
0
        public ActionResult CreateRealEstate()
        {
            RealEstateAssetData model = new RealEstateAssetData
            {
                Asset = new Asset { UserId = UserId, AssetType = AssetType.RealEstate, Symbol = "zpid" }
            };

            return View(model);
        }
 public void AddRealEstateAssetData(RealEstateAssetData realEstateAssetData)
 {
     context.RealEstateAssetData.Add(realEstateAssetData);
     SaveChanges();
 }