예제 #1
0
        public ProductListResponse GetProductList([ModelBinder(typeof(FieldValueModelBinder))] GetProductsBySearchRequest request)
        {
            var resp = new ProductListResponse();

            resp.Products = new Models.Products();

            Models.ProductSearchField searchField = 0;
            string   searchText = null;
            Decimal? priceLow   = null;
            Decimal? priceHigh  = null;
            DateTime?dateFrom   = null;
            DateTime?dateTo     = null;

            if (request.ProductSearchFilter != null)
            {
                searchField = request.ProductSearchFilter.ProductSearchField;
                searchText  = request.ProductSearchFilter.ProductSearchText;
            }
            if (request.PriceSearchFilter != null)
            {
                if (!String.IsNullOrEmpty(request.PriceSearchFilter.SearchPriceLow))
                {
                    priceLow = Convert.ToDecimal(request.PriceSearchFilter.SearchPriceLow);
                }
                if (!String.IsNullOrEmpty(request.PriceSearchFilter.SearchPriceHigh))
                {
                    priceHigh = Convert.ToDecimal(request.PriceSearchFilter.SearchPriceHigh);
                }
            }
            if (request.DateSearchFilter != null)
            {
                if (!String.IsNullOrEmpty(request.DateSearchFilter.SearchDateFrom))
                {
                    dateFrom = Convert.ToDateTime(request.DateSearchFilter.SearchDateFrom);
                }
                if (!String.IsNullOrEmpty(request.DateSearchFilter.SearchDateTo))
                {
                    dateTo = Convert.ToDateTime(request.DateSearchFilter.SearchDateTo);
                }
            }
            int totalCount   = 0;
            int newPageIndex = -1;

            IProductBS bs = default(IProductBS);

            //IProductBS prodBs = DIFactoryDesigntime.GetInstance<IProductBS>();
            //try
            //{
            bs = DIFactoryDesigntime.GetInstance <IProductBS>();
            //}
            //catch (Exception ex)
            //{
            //    var msg = ex.Message;
            //}

            //IProductRepository productRepo = new ProductRepository(new StoreDataModelUnitOfWork());
            IEnumerable <ProductCM> rtnList = bs.GetProductList(searchField, searchText,
                                                                priceLow, priceHigh, dateFrom, dateTo, request.StatusCode, request.PaginationRequest,
                                                                out totalCount, out newPageIndex);

            resp.Products.AddRange(rtnList);
            resp.TotalCount = totalCount;
            return(resp);
        }
예제 #2
0
        public void DeleteProduct(int id)
        {
            IProductBS bs = DIFactoryDesigntime.GetInstance <IProductBS>();

            bs.DeleteProduct(id);
        }
예제 #3
0
        //GET: api/IPAddresss
        public IQueryable <PingCo.Model.IPAddress> GetIPAddresses()
        {
            IIPAddressBS bs = DIFactoryDesigntime.GetInstance <IIPAddressBS>();

            return(bs.GetIPAddresses());
        }