51 lines
1.5 KiB
C#
51 lines
1.5 KiB
C#
|
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<List<ProjectModeDto>> 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<List<TestingProjectDto>> 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;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|