Beispiel #1
0
        public void UpdateProfessional(ProfessionalBuilder builder)
        {
            var professional = builder.Build();

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

            var keys = new ComposeKey <Guid, decimal>(professional.Code, professional.ProfessionalId);

            if (!_professionalRepository.ExistsProfessional(keys))
            {
                Notification.Raise(NotificationEvent.DefaultBuilder
                                   .WithNotFoundStatus()
                                   .WithMessage(AppConsts.LocalizationSourceName, Professional.Error.CouldNotFindProfessional)
                                   .Build());
            }

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

            _professionalRepository.UpdateProfessional(professional);
            _professionalRepository.AddOrRemoveSpecialties(keys, professional.Specialties);
        }
Beispiel #2
0
        public ComposeKey <Guid, decimal> CreateProfessional(ProfessionalBuilder builder)
        {
            var professional = builder.Build();

            if (Notification.HasNotification())
            {
                return(new ComposeKey <Guid, decimal>());
            }

            var keys = _professionalRepository.CreateProfessional(professional);

            _professionalRepository.AddOrRemoveSpecialties(keys, professional.Specialties);

            return(keys);
        }