server/aspnetapp/Controllers/WebUI/BuyrUserController.cs

(开头部分) 19KB

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

#nullable disable
using aspnetapp.Helper;
using aspnetapp.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;

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

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

        public async Task<IActionResult> Binding(int? id, int? pageindex)
        {
            if (id == null)
            {
                return NotFound();
            }
            ViewBag.pageindex = pageindex;

            var buyrUserEntity = await _context.BuyrUsers.FindAsync(id);
            if (buyrUserEntity == null)
            {
                return NotFound();
            }
            var allthisuCoworkers = await _context.BuyrUsers.Where(s => s.Company == buyrUserEntity.Company && s.Id != id && s.UserStatus == (int)EnumCode.UserStatus.已审核).ToListAsync().ConfigureAwait(false);
            ViewBag.Coworkers = allthisuCoworkers;

            var allthisucheck = await _context.RU2Users.Where(s => s.UserId == buyrUserEntity.Id).ToListAsync().ConfigureAwait(false);
            ViewBag.CheckCoworkers = allthisucheck;

            return View(buyrUserEntity);
        }

        [HttpPost]
        public async Task<IActionResult> Binding(int? id, int[] checkuserids, int? pageindex)
        {
            if (id == null)
            {
                return NotFound();
            }

            if (checkuserids.Any())
            {
                var allthisucheck = await _context.RU2Users.Where(s => s.UserId == id).ToListAsync().ConfigureAwait(false);
                if (allthisucheck.Any())
                {
                    _context.RU2Users.RemoveRange(allthisucheck);
                    await _context.SaveChangesAsync().ConfigureAwait(false);
                }

                foreach (var item in checkuserids)
                {
                    RU2User nc2u = new RU2User() { UserId = id.Value, U2UserId = item };
                    await _context.RU2Users.AddAsync(nc2u).ConfigureAwait(false);
后面还有 448 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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