server/aspnetapp/Controllers/WebUI/AnalyseController.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using aspnetapp.Helper;
using aspnetapp.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;

namespace aspnetapp.Controllers.WebUI
{
    public class AnalyseController : Controller
    {
        private readonly CounterContext _context;

        public AnalyseController(CounterContext context)
        {
            _context = context;
        }

        // 派餐统计
        public async Task<IActionResult> ServeMeals(int? ordertype, DateTime? chooseTime)
        {
            ViewBag.thisordertype = ordertype;
            ViewBag.ordertype = typeof(EnumCode.OrderTypeShow)._ToSelectListItems();
            if (ordertype.HasValue)
            {
                ViewBag.ordertype = typeof(EnumCode.OrderTypeShow)._ToSelectListItems(ordertype);
                if (ordertype == (int)EnumCode.OrderTypeShow.晚餐)
                {
                    ordertype = (int)EnumCode.OrderType.晚餐;
                }
            }

            ViewBag.chooseTime = chooseTime;
            DateTime now = DateTime.Now;
            if (chooseTime != null)
            {
                now = chooseTime.Value;
            }
            DateTime today = new DateTime(now.Year, now.Month, now.Day);
            DateTime tomorrow = new DateTime(now.Year, now.Month, now.Day).AddDays(1);

            List<OrderEntity> allorders = await _context.Orders.AsNoTracking().Where(s => s.OrderStatus != (int)EnumCode.OrderStatus.已取消 && (s.OrderForDate == today || s.OrderForDate == tomorrow) &&(ordertype.HasValue ? s.OrderType == ordertype.Value : true)).OrderBy(s => s.BuildingId).ToListAsync();

            return View(allorders);
        }

        // 备餐统计
        public async Task<IActionResult> PrepareMeals(DateTime? chooseTime)
        {
            ViewBag.chooseTime = chooseTime;
            DateTime now = DateTime.Now;
            if (chooseTime != null)
            {
                now = chooseTime.Value;
            }
            DateTime today = new DateTime(now.Year, now.Month, now.Day);

            List<OrderEntity> allorders = await _context.Orders.AsNoTracking().Where(s => s.OrderStatus != (int)EnumCode.OrderStatus.已取消 && s.OrderForDate == today).OrderBy(s => s.BuildingId).ToListAsync();

            return View(allorders);
        }
    }
后面还有 1 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。