source: StockMaster/Controllers/DashboardController.cs@ dfe03b8

main
Last change on this file since dfe03b8 was dfe03b8, checked in by Ceyda <ceyda.huseini@…>, 4 days ago

Initialize StockMaster project

  • Property mode set to 100644
File size: 648 bytes
Line 
1using Microsoft.AspNetCore.Authorization;
2using Microsoft.AspNetCore.Mvc;
3using Microsoft.EntityFrameworkCore;
4using StockMaster.Data;
5
6namespace StockMaster.Controllers
7{
8 [Authorize]
9 public class DashboardController : Controller
10 {
11 private readonly StockDbContext _context;
12 public DashboardController(StockDbContext context) => _context = context;
13
14 public IActionResult Index()
15 {
16 ViewBag.Products = _context.Products.Count();
17 ViewBag.TodaySales = _context.Sales.Where(s => s.DateTime.Date == DateTime.Today).Sum(s => s.TotalAmount);
18 return View();
19 }
20 }
21}
Note: See TracBrowser for help on using the repository browser.