Exemple #1
0
        public int GetTotalProductSellCurrentMonth()
        {
            // tính tổng sản phẩm đã bán tháng trước

            int sum = 0;

            List <DonHang> dhs = _donHangRepository.GetAll().ToList();

            foreach (var item in dhs)
            {
                if (item.NgayDatMua.Value.Month == DateTime.Now.Month)
                {
                    foreach (var i in _chiTietDonHangRepository.GetAllByIdDonHang(item.MaDh))
                    {
                        sum = sum + i.SoLuong.Value;
                    }
                }
            }
            return(sum);
        }
 public IActionResult Test()
 {
     return(Ok(_repository.GetAll()));
 }