using AutoMapper; using Microsoft.EntityFrameworkCore; using System.Collections.Generic; using YD_XinWei.Api.Context; using YD_XinWei.Api.Services.Interface; using YD_XinWei.Api.SmartSportsEntitys; using YD_XinWei.Api.Utilities; using YD_XinWei.Commons.Dto.Common; using YD_XinWei.Commons.Dto.HomeWork; using YD_XinWei.Commons.Dto.School; namespace YD_XinWei.Api.Services.Impl { public class XinWeiService : IXinWeiService { public SmartSportsContext _sportsContext; private readonly IMapper _mapper; public XinWeiService(SmartSportsContext sportsContext, IMapper mapper) { _sportsContext = sportsContext; _mapper = mapper; } public async Task> SportsModelTypeList() { var res = await _sportsContext.XW_ProjectMode.Select(x => new ProjectModeDto() { Id = x.Id, ProjectKind = x.ProjectKind, Name = x.Name }).ToListAsync(); return res; } public async Task> OrgSportsProjectList(int orgId) { var res = await _sportsContext.XW_TestingProject.Where(x => x.OrgId == orgId).Select(x => new TestingProjectDto() { ProjectId = x.ProjectId, IsOpen = x.IsOpen, IsShow = x.IsShow, ProjectName = x.ProjectName }).ToListAsync(); return res; } } }