コード例 #1
0
        public IActionResult Index()
        {
            var userName = HttpContext.User.Identity.Name;

            ViewBag.UserId = _userService.All().First(u => u.Login == userName).Id;

            ViewBag.Categories = _categoryService.All();
            ViewBag.Shops      = _shopService.All();

            var result = ProductService.GetProductsInStock(_db, _postgresContext);

            return(View(result));
        }
コード例 #2
0
ファイル: ShopController.cs プロジェクト: LettoL/bvdShopCore
 public IActionResult Index()
 {
     return(View(_shopService.All().ToList().Select(x => new ShopVM()
     {
         Id = x.Id,
         Title = x.Title,
         CashOnHand = _shopService.CashOnHand(_db, x.Id),
         Margin = _shopService.Margin(x.Id),
         Sales = _saleService.All()
                 .Where(s => s.Date.Month == DateTime.Now.AddHours(3).Month&& s.Payment == true)
                 .Count(s => s.ShopId == x.Id),
         Turnover = _shopService.Turnover(x.Id)
     })));
 }
コード例 #3
0
        public IActionResult BookingList()
        {
            var  userName = HttpContext.User.Identity.Name;
            User user     = _userService.All().First(u => u.Login == userName);
            Shop shop     = _shopService.All().First(s => s.Id == user.ShopId);


            return(View(_bookingService.All()
                        .Where(x => x.ShopId == shop.Id)
                        .OrderByDescending(x => x.Id)
                        .Select(x => new BookingListVM()
            {
                Date = x.Date,
                Id = x.Id,
                Debt = x.Debt,
                Pay = x.Pay,
                Sum = x.Sum,
                Status = x.Status,
                ProductTitle = _bookingProductService.All()
                               .Include(z => z.Product).FirstOrDefault(z => z.BookingId == x.Id).Product.Title ?? ""
            })));
        }
コード例 #4
0
ファイル: UserController.cs プロジェクト: LettoL/bvdShopCore
        public IActionResult Create()
        {
            ViewBag.shops = _shopService.All();

            return(View());
        }