コード例 #1
0
ファイル: HomeController.cs プロジェクト: frandi/ANTAMFeed
        public ActionResult Edit(int? id)
        {
            ViewData[Constants.SUCCESS_MESSAGE] = TempData[Constants.SUCCESS_MESSAGE];

            IGoldPriceService svc = new GoldPriceService();

            GoldPrice model = null;

            // try getting from database
            if (id != null)
                model = svc.Get(id.Value);

            // try getting from previously fetched data from ANTAM
            if (model == null)
                model = TempData[Constants.PRICE_FROM_ANTAM] as GoldPrice;

            // just create new object
            if (model == null)
            {
                model = new GoldPrice();
                model.PriceDate = DateTime.Today;
            }

            return View(model);
        }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: frandi/ANTAMFeed
        public ActionResult Details(int id)
        {
            IGoldPriceService svc = new GoldPriceService();
            GoldPrice model = svc.Get(id);

            if (model == null)
                return RedirectToAction("Index");

            return View(model);
        }