using EasyCaching.Core.Interceptor; using IRaCIS.Application.ViewModels; using IRaCIS.Core.Domain.Interfaces; using IRaCIS.Core.Domain.Share; using System; using System.Linq; namespace IRaCIS.Core.Application { public interface ICastleService { [EasyCachingAble(Expiration = 10)] DoctorBasicInfoDTO GetDoctorBasicInfo(Guid doctorId); } public class CastleService : ICastleService { private readonly IDoctorRepository _doctorRepository; public CastleService(IDoctorRepository doctorRepository) { _doctorRepository = doctorRepository; } public DoctorBasicInfoDTO GetDoctorBasicInfo(Guid doctorId) { var doctorQueryable = _doctorRepository .Find(t => t.Id == doctorId) .Select(doctor => new DoctorBasicInfoDTO() { Id = doctor.Id, Code = doctor.Code, ChineseName = doctor.ChineseName, EMail = doctor.EMail, FirstName = doctor.FirstName, Introduction = doctor.Introduction, LastName = doctor.LastName, Phone = doctor.Phone, Sex = doctor.Sex, WeChat = doctor.WeChat, TitleIds = doctor.DoctorDicList .Where(t => t.KeyName == StaticData.Title).Select(t => t.DictionaryId).ToList() }); var doctorBasicInfo = doctorQueryable.FirstOrDefault(); return doctorBasicInfo; } } //[ProtoContract] //[System.Serializable] public class Demo { //[ProtoMember(1)] public int Id { get; set; } //[ProtoMember(2)] public string Name { get; set; } //[ProtoMember(3)] public System.DateTime CreateTime { get; set; } } }