Ejemplo n.º 1
0
        public Shipper getshipper(int id, string companyName, string phone)
        {
            var query = Dbset.AsQueryable();

            query = query.Where(x => x.ShipperId == id && x.CompanyName == companyName && x.Phone == phone);
            return(query.FirstOrDefault());
        }
Ejemplo n.º 2
0
        public List <Cart> Carts(string customerId)
        {
            var query = Dbset.AsQueryable();

            query = query.Include(x => x.Customer).Where(x => x.CustomerId == customerId);
            return(query.ToList());
        }
Ejemplo n.º 3
0
        public OrderDetail getOrderDetail(int OrderId, int productId)
        {
            var query = Dbset.AsQueryable();

            query = query.Where(x => x.OrderId == OrderId && x.ProductId == productId);
            return(query.FirstOrDefault());
        }
Ejemplo n.º 4
0
        public Product getProduct(int productId, string ProductName)
        {
            var query = Dbset.AsQueryable();

            query = query.Where(x => x.ProductId == productId && x.ProductName == ProductName);
            return(query.FirstOrDefault());
        }
Ejemplo n.º 5
0
        public Category getCategory(int categoryId, string categoryName)
        {
            var query = Dbset.AsQueryable();

            query = query.Where(x => x.CategoryId == categoryId && x.CategoryName == categoryName);
            return(query.FirstOrDefault());
        }
Ejemplo n.º 6
0
        public Order getOrder(int OrderId, string customerId, int?employeeId)
        {
            var query = Dbset.AsQueryable();

            query = query.Where(x => x.CustomerId == customerId && x.OrderId == OrderId && x.EmployeeId == employeeId);
            return(query.FirstOrDefault());
        }
Ejemplo n.º 7
0
        public Employee GetInfor(int id)
        {
            var query = Dbset.AsQueryable();

            query = query.Where(x => x.EmployeeId == id);
            return(query.FirstOrDefault());
        }
Ejemplo n.º 8
0
        public Employee getEmployee(int EmployeeId, string FirstName, string lastName)
        {
            var query = Dbset.AsQueryable();

            query = query.Where(x => x.EmployeeId == EmployeeId && x.FirstName == FirstName && x.LastName == lastName);
            return(query.FirstOrDefault());
        }
Ejemplo n.º 9
0
        public Customer SignIn(string User, string Pass)
        {
            var query = Dbset.AsQueryable();

            query = query.Where(x => x.User == User && x.Password == Pass);
            return(query.FirstOrDefault());
        }
Ejemplo n.º 10
0
        public Customer GetById(string customerId)
        {
            var query = Dbset.AsQueryable();

            query = query.Where(x => x.CustomerId == customerId);
            return(query.FirstOrDefault());
        }
Ejemplo n.º 11
0
        public Customer getCustomer(string customerId, string ContactName, string CompanyName)
        {
            var query = Dbset.AsQueryable();

            query = query.Where(x => x.CustomerId == customerId && x.ContactName == ContactName && x.CompanyName == CompanyName);
            return(query.FirstOrDefault());
        }
Ejemplo n.º 12
0
        public List <Order> Search(int currentPage, int pageSize, string textSearch, string sortColumn, string sortDirection, out int totalPage)
        {
            currentPage = (currentPage <= 0) ? 1 : currentPage;
            pageSize    = (pageSize <= 0) ? 20 : pageSize;

            var query = Dbset.AsQueryable();

            totalPage = query.Count();
            if (!string.IsNullOrEmpty(sortColumn))
            {
                query = query.OrderByField(sortColumn.Trim(), sortDirection);
            }
            else
            {
                query = query.OrderByDescending(c => c.OrderId);
            }

            return(query.Skip((currentPage - 1) * pageSize).Take(pageSize).ToList());
        }
Ejemplo n.º 13
0
        public List <Cart> GetAllProduct()
        {
            var query = Dbset.AsQueryable();

            return(query.ToList());
        }
Ejemplo n.º 14
0
        public List <Category> GetListCategory()
        {
            var query = Dbset.AsQueryable();

            return(query.ToList());
        }