Пример #1
0
        public ProfessionalDto GetProfessional(RequestDto <ComposeKey <Guid, decimal> > keys)
        {
            var professionalId = keys.GetId().SecundaryKey;
            var code           = keys.GetId().PrimaryKey;

            if (professionalId <= 0)
            {
                RaiseNotification(nameof(professionalId));
            }

            if (code == Guid.Empty)
            {
                RaiseNotification(nameof(code));
            }

            if (Notification.HasNotification())
            {
                return(new ProfessionalDto());
            }

            var entity = _service.GetProfessional(keys);
            var dto    = entity.MapTo <ProfessionalDto>();

            dto.RemoveExpandable(keys);

            return(dto);
        }
Пример #2
0
        private ProfessionalPoco GetProfessionalPoco(RequestDto <ComposeKey <Guid, decimal> > requestDto)
        {
            var dbEntity = Context.Professionals
                           .IncludeByRequestDto(requestDto)
                           .Where(w => w.ProfessionalId == requestDto.GetId().SecundaryKey&& w.Code == requestDto.GetId().PrimaryKey)
                           .SelectFieldsByRequestDto(requestDto)
                           .SingleOrDefault();

            return(dbEntity);
        }
Пример #3
0
        public Professional GetProfessional(RequestDto <ComposeKey <Guid, decimal> > keys)
        {
            if (!_professionalRepository.ExistsProfessional(keys.GetId()))
            {
                Notification.Raise(NotificationEvent.DefaultBuilder
                                   .WithNotFoundStatus()
                                   .WithMessage(AppConsts.LocalizationSourceName, Professional.Error.CouldNotFindProfessional)
                                   .Build());

                return(null);
            }

            return(_professionalRepository.GetProfessional(keys));
        }
Пример #4
0
        public Specialty GetSpecialty(RequestDto requestDto)
        {
            if (!_specialtyRepository.ExistsSpecialty(requestDto.GetId()))
            {
                Notification.Raise(NotificationEvent.DefaultBuilder
                                   .WithNotFoundStatus()
                                   .WithMessage(AppConsts.LocalizationSourceName, Specialty.Error.CouldNotFindSpecialty)
                                   .Build());

                return(null);
            }

            return(_specialtyRepository.GetSpecialty(requestDto));
        }
Пример #5
0
        public SpecialtyDto GetSpecialty(RequestDto id)
        {
            if (id.GetId() <= 0)
            {
                RaiseNotification(nameof(id));
            }

            if (Notification.HasNotification())
            {
                return(new SpecialtyDto());
            }

            var entity = _service.GetSpecialty(id);

            return(entity.MapTo <SpecialtyDto>());
        }
Пример #6
0
        public async Task <PresidentDto> GetPresidentById(RequestDto <string> id)
        {
            if (string.IsNullOrWhiteSpace(id.GetId()))
            {
                RaiseNotification(nameof(id));
            }

            if (Notification.HasNotification())
            {
                return(new PresidentDto());
            }

            var entity = await _whiteHouserService.GetPresidentById(id);

            return(entity.MapTo <PresidentDto>());
        }
Пример #7
0
        public async Task <President> GetPresidentById(RequestDto <string> requestDto)
        {
            var presidentData = await GetAsync(requestDto.GetId());

            return(presidentData.MapTo <President>());
        }
Пример #8
0
        public Task <President> GetPresidentById(RequestDto <string> requestDto)
        {
            _presidents.TryGetValue(requestDto.GetId(), out PresidentPoco presidentpoco);

            return(Task.FromResult(presidentpoco.MapTo <President>()));
        }
Пример #9
0
        public Professional GetProfessional(RequestDto <ComposeKey <Guid, decimal> > requestDto)
        {
            var professional = FirstOrDefault(w => w.ProfessionalId == requestDto.GetId().SecundaryKey&& w.Code == requestDto.GetId().PrimaryKey);

            return(professional.MapTo <Professional>());
        }