Пример #1
0
 public AuthorizationService(IIllnessesHistoryRepository illnessesHistoryRepository,
                             IVisitsRepository visitsRepository, IReservationsRepository reservationsRepository)
 {
     _visitsRepository           = visitsRepository;
     _illnessesHistoryRepository = illnessesHistoryRepository;
     _reservationsRepository     = reservationsRepository;
 }
Пример #2
0
        public MedicineHistoryValidator(IMedicinesRepository medicinesRepository, IIllnessesHistoryRepository illnessesHistoryRepository)
        {
            RuleFor(x => x.MedicineId)
            .Cascade(CascadeMode.Stop)
            .NotEmpty().WithMessage("Pole nie może być puste.")
            .SetValidator(new BaseIdValidator <Medicine>(medicinesRepository, "Lek nie istnieje."));

            RuleFor(x => x.IllnesshistoryId)
            .Cascade(CascadeMode.Stop)
            .NotEmpty().WithMessage("Pole nie może być puste.")
            .SetValidator(new BaseIdValidator <Illnesshistory>(illnessesHistoryRepository, "Historia choroby nie istnieje."));

            RuleFor(x => x.Startdate)
            .Cascade(CascadeMode.Stop)
            .NotEmpty().WithMessage("Pole nie może być puste.");

            RuleFor(x => x)
            .Cascade(CascadeMode.Stop)
            .Must(x => x.Finishdate.Value >= x.Startdate)
            .When(x => x.Finishdate.HasValue).WithMessage("Data końcowa nie może być wcześniejsza niż początkowa.");

            RuleFor(x => x.Description)
            .Cascade(CascadeMode.Stop)
            .MaximumLength(255).WithMessage("Maksymalna długość wynosi {MaxLength} znaków, wpisano {TotalLength}.");
        }
Пример #3
0
 public IllnesseshistoryController(IIllnessesHistoryRepository context, IVisitsRepository visitsRepository,
                                   IOldIllnessesHistoryRepository oldIllnessesHistoryRepository, IReservationsRepository reservationsRepository, AuthorizationService authorizationService)
 {
     _repository       = context;
     _visitsRepository = visitsRepository;
     _oldIllnessesHistoryRepository = oldIllnessesHistoryRepository;
     _reservationsRepository        = reservationsRepository;
     _authorizationService          = authorizationService;
 }
Пример #4
0
        public IllnessHistoryValidator(IIllnessesHistoryRepository illHistRepo, IPatientsRepository patRepo,
                                       IIllnessesRepository illRepo, IVisitsRepository visitRepo, IHttpContextAccessor httpContext)
        {
            RuleFor(x => x.IllnessId)
            .Cascade(CascadeMode.Stop)
            .NotEmpty().WithMessage("Pole nie może być puste.")
            .SetValidator(new BaseIdValidator <Illness>(illRepo, "Choroba nie istnieje."));

            RuleFor(x => x.VisitId)
            .Cascade(CascadeMode.Stop)
            .NotEmpty().WithMessage("Pole nie może być puste.")
            .Must(x => visitRepo.Exists(x)).WithMessage("Wizyta nie istnieje.");

            RuleFor(x => x.Description)
            .MaximumLength(1023).WithMessage("Maksymalna długość wynosi {MaxLength} znaków, wpisano {TotalLength}.");
        }