Example #1
0
 public UpdateInoculationValidator(EditPatientVM parent)
 {
     When(i => !i.IsDeleted, () =>
     {
         RuleFor(x => x.VaccineId).Required();
         RuleFor(x => x.Date).DatesRange(parent.BirthDate.Value, DateTime.Now);
     });
 }
        public async Task <IActionResult> EditPatient(EditPatientVM vm)
        {
            if (!ModelState.IsValid)
            {
                vm.AllVaccines = await Mediator.Send(new AllVaccinesQuery());

                return(View(vm));
            }

            var result = await Mediator.Send(new UpdatePatientCommand(vm));

            ProcessResultBeforeRedirect(result);
            return(Redirect(Url.Action(PatientsRoutes.patient, PatientsRoutes.controller, new { vm.Id })));
        }
 public UpdatePatientCommand(EditPatientVM vm)
 {
     Patient = vm;
 }