Esempio n. 1
0
        public PriceController()
        {
            var sqlLiteDbPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data", "prices.s3db");
            var priceDb       = new PriceDb("Data Source=" + sqlLiteDbPath);

            _priceService = new PriceService(new ModelStateAdapter(ModelState), priceDb);
        }
        public ViewResult Index(PriceLookup price)
        {
            var connectionString = @"Data Source=" + Server.MapPath("App_Data/prices.s3db");
            var priceDb = new PriceDb(connectionString);
            var priceSvc = new PriceService(ModelState, priceDb);
            if (ModelState.IsValid)
                price.Price = priceSvc.GetPrice(price);

            return View(price);
        }
        public ViewResult Index(PriceLookup price)
        {
            var connectionString = @"Data Source=" + Server.MapPath("App_Data/prices.s3db");
            var priceDb          = new PriceDb(connectionString);
            var priceSvc         = new PriceService(ModelState, priceDb);

            if (ModelState.IsValid)
            {
                price.Price = priceSvc.GetPrice(price);
            }

            return(View(price));
        }