示例#1
0
        public static IQueryable <Category> listCategory()
        {
            ShoesShopOnline db    = new ShoesShopOnline();
            var             query = (from category in db.Categories
                                     select category);

            return(query);
        }
示例#2
0
        public static IQueryable <User> getUserById(int userId)
        {
            ShoesShopOnline db    = new ShoesShopOnline();
            var             query = (from user in db.Users
                                     where user.userId == userId
                                     select user);

            return(query);
        }
示例#3
0
        public static IQueryable <User> getUserByEmail(String email)
        {
            ShoesShopOnline db    = new ShoesShopOnline();
            var             query = (from user in db.Users
                                     where user.email == email
                                     select user);

            return(query);
        }
示例#4
0
        public static IQueryable <Product> getProductInfo(int productId)
        {
            ShoesShopOnline db    = new ShoesShopOnline();
            var             query = (from product in db.Products
                                     where product.productId == productId
                                     select product);

            return(query);
        }
示例#5
0
        public static IPagedList <Product> getListProduct(int page, int size)
        {
            ShoesShopOnline db    = new ShoesShopOnline();
            var             query = (from product in db.Products
                                     where product.isAvailable == true
                                     orderby product.releaseDate
                                     select product).ToPagedList(page, size);

            return(query);
        }
示例#6
0
 public ProductDao()
 {
     db = new ShoesShopOnline();
 }
示例#7
0
 public CartDao()
 {
     db = new ShoesShopOnline();
 }
示例#8
0
 public UserDao()
 {
     db = new ShoesShopOnline();
 }
示例#9
0
        public static IPagedList <Product> getAllProduct(int?manufacturerId, int sort, int order, int page, int size)
        {
            ShoesShopOnline db = new ShoesShopOnline();

            if (order == 1)
            {
                if (manufacturerId != null)
                {
                    if (sort == 1)
                    {
                        var query = (from product in db.Products
                                     where product.manufacturerId == manufacturerId
                                     orderby product.productName descending
                                     select product).ToPagedList(page, size);
                        return(query);
                    }
                    else
                    {
                        var query = (from product in db.Products
                                     where product.manufacturerId == manufacturerId
                                     orderby product.productName ascending
                                     select product).ToPagedList(page, size);
                        return(query);
                    }
                }
                else
                {
                    if (sort == 1)
                    {
                        var query = (from product in db.Products
                                     orderby product.productName descending
                                     select product).ToPagedList(page, size);
                        return(query);
                    }
                    else
                    {
                        var query = (from product in db.Products
                                     orderby product.productName ascending
                                     select product).ToPagedList(page, size);
                        return(query);
                    }
                }
            }
            else
            {
                if (manufacturerId != null)
                {
                    if (sort == 1)
                    {
                        var query = (from product in db.Products
                                     where product.manufacturerId == manufacturerId
                                     orderby product.price descending
                                     select product).ToPagedList(page, size);
                        return(query);
                    }
                    else
                    {
                        var query = (from product in db.Products
                                     where product.manufacturerId == manufacturerId
                                     orderby product.price ascending
                                     select product).ToPagedList(page, size);
                        return(query);
                    }
                }
                else
                {
                    if (sort == 1)
                    {
                        var query = (from product in db.Products
                                     orderby product.price descending
                                     select product).ToPagedList(page, size);
                        return(query);
                    }
                    else
                    {
                        var query = (from product in db.Products
                                     orderby product.price ascending
                                     select product).ToPagedList(page, size);
                        return(query);
                    }
                }
            }
        }
示例#10
0
 public ManufacturerDao()
 {
     db = new ShoesShopOnline();
 }
示例#11
0
 public InvoiceDao()
 {
     db = new ShoesShopOnline();
 }
示例#12
0
        public static List <Manufacturer> getListManufacturer()
        {
            ShoesShopOnline db = new ShoesShopOnline();

            return(db.Manufacturers.ToList());
        }
示例#13
0
 public AdminDao()
 {
     db = new ShoesShopOnline();
 }
示例#14
0
 public CategoryDao()
 {
     db = new ShoesShopOnline();
 }
示例#15
0
 public TransactionDao()
 {
     db = new ShoesShopOnline();
 }
示例#16
0
 public MethodDao()
 {
     db = new ShoesShopOnline();
 }
示例#17
0
 public LoginDao()
 {
     db = new ShoesShopOnline();
 }