MoonBoxController控制器代码
作者:互联网
public class MoonBoxController : Controller { private readonly IWebHostEnvironment _webHostEnvironment; private readonly IRepository<MoonBox, int> _moonboxRepository; private readonly IMoonBoxService _moonboxService; private readonly IRepository<Course, int> _courseRepository; private readonly IRepository<MoonBoxCourse, int> _moonboxcourseRepository; private readonly SignInManager<ApplicationUser> _signInManager; private readonly IDataProtector _protector; public MoonBoxController(IWebHostEnvironment webHostEnvironment, IRepository<MoonBox, int> moonboxRepository, IMoonBoxService moonboxService, IDataProtectionProvider dataProtectionProvider, DataProtectionPurposeStrings dataProtectionPurposeStrings, IRepository<Course, int> courseRepository, IRepository<MoonBoxCourse, int> moonboxcourseRepository, SignInManager<ApplicationUser> signInManager) { _webHostEnvironment = webHostEnvironment; _moonboxRepository = moonboxRepository; _moonboxService = moonboxService; _protector = dataProtectionProvider.CreateProtector( dataProtectionPurposeStrings.CourseIdRouteValue); _courseRepository = courseRepository; _moonboxcourseRepository = moonboxcourseRepository; _signInManager = signInManager; } public async Task<IActionResult> Index(GetMoonBoxInput input) { if (_signInManager.IsSignedIn(User)) { input.UserName = User.Identity.Name; ViewBag.user = User.Identity.Name; } var models = await _moonboxService.GetPagedMoonBoxList(input); var dto = new MoonBoxListViewModel(); dto.MoonBoxs = models; return View(dto); } }
标签:控制器,moonboxRepository,代码,IRepository,readonly,private,moonboxService,MoonBoxCont 来源: https://www.cnblogs.com/chinacox/p/14419497.html