Beispiel #1
0
        public async Task <ActionResult <IEnumerable <object> > > PerformedTreatments(decimal visitId, int?limit, int?skip)
        {
            if (!_visitsRepository.Exists(visitId))
            {
                return(NotFound(NotFoundEmptyJsonResult));
            }
            if (!await _authorizationService.CanUserAccessVisit(visitId, this))
            {
                return(Unauthorized(UnauthorizedEmptyJsonResult));
            }

            return(Ok(await _repository.PerformedTreatments(visitId, limit, skip)));
        }
Beispiel #2
0
        public async Task <ActionResult <IEnumerable <object> > > AllByVisitId(decimal visitId, int?limit, int?skip)
        {
            if (!_visitsRepository.Exists(visitId))
            {
                return(NotFound(NotFoundEmptyJsonResult));
            }
            if (!await _authorizationService.CanUserAccessVisit(visitId, this))
            {
                return(Unauthorized(UnauthorizedEmptyJsonResult));
            }

            var illnesshistoryList = await _repository.AllByVisitId(visitId, limit, skip);

            return(illnesshistoryList.ToList());
        }
Beispiel #3
0
        public TreatmentOnVisitValidator(ITreatmentsRepository treatmentsRepository, IVisitsRepository visitsRepository)
        {
            RuleFor(x => x.TreatmentId)
            .Cascade(CascadeMode.Stop)
            .NotEmpty().WithMessage("Pole nie może być puste.")
            .SetValidator(new BaseIdValidator <Treatment>(treatmentsRepository, "Zabieg nie istnieje."));

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

            RuleFor(x => x.Description)
            .Cascade(CascadeMode.Stop)
            .MaximumLength(511).WithMessage("Maksymalna długość wynosi {MaxLength} znaków, wpisano {TotalLength}.");
        }
Beispiel #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}.");
        }
 private bool VisitExists(decimal id)
 {
     return(_repository.Exists(id));
 }