using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; using Volo.Abp.Application.Services; using Volo.Abp.Domain.Repositories; using Volo.Abp.ObjectMapping; namespace Shentun.Peis.Books { [ApiExplorerSettings(GroupName = "Sys")] public class StudentAppService : ApplicationService, IStudentAppService { private readonly IRepository _repository; public StudentAppService(IRepository repository) { _repository = repository; } public async Task CreateAsync(CreateStudentDto input) { var studentinfo = await _repository.InsertAsync(new Student(input.Sid, input.Uid, input.Cid, input.Name)); return ObjectMapper.Map(studentinfo); } public async Task DeleteAsync(Guid Sid, Guid Uid, string Cid) { var studentinfo = (await _repository.GetQueryableAsync()) .Where(x => x.Sid == Sid) .Where(x => x.Uid == Uid) .Where(x => x.Cid == Cid).FirstOrDefault(); await _repository.DeleteAsync(studentinfo); //软删除 //await _repository.HardDeleteAsync(studentinfo); //物理删除 } public async Task> GetAsync(StudentDto studentDto) { var studentlist = (await _repository.GetQueryableAsync()) .Where(x => x.Sid == studentDto.Sid) .Where(x => x.Uid == studentDto.Uid) .Where(x => x.Cid == studentDto.Cid).ToList(); return ObjectMapper.Map, List>(studentlist); // List landInfos = (await _landInfoRepository.GetQueryableAsync()) //.WhereIf(!string.IsNullOrEmpty(input.Name), x => x.landName.Contains(input.Name) || x.landName == input.Name) //.WhereIf(!string.IsNullOrEmpty(input.Description), x => x.remark.Contains(input.Description) || x.remark == input.Description) //.Skip((input.pageNo - 1) * input.pageSize) //.Take(input.pageSize) //.ToList(); } public async Task GetAsyncMyName(string Name) { var studentinfo = (await _repository.GetQueryableAsync()) .WhereIf(!string.IsNullOrEmpty(Name), x => x.Name == Name).FirstOrDefault(); return ObjectMapper.Map(studentinfo); } } }