Beispiel #1
0
        public async Task <IActionResult> BecomePatient(PatientsCreateInputModel patientCreateInputModel)
        {
            if (!this.ModelState.IsValid)
            {
                var cities     = this.cityService.AllCities().Result;
                var inputModel = new PatientsCreateInputModel
                {
                    Cities = cities,
                };

                return(this.View(inputModel));
            }

            var user = await this.userManager.GetUserAsync(this.HttpContext.User);

            var model = new PatientServiceModel()
            {
                FullName   = patientCreateInputModel.FullName,
                Age        = patientCreateInputModel.Age,
                HospitalId = patientCreateInputModel.HospitalId,
                BloodType  = new BloodTypeServiceModel
                {
                    ABOGroupName = patientCreateInputModel.BloodType.ABOGroupName,
                    RhesusFactor = patientCreateInputModel.BloodType.RhesusFactor,
                },
                UserId           = user.Id,
                Ward             = patientCreateInputModel.Ward,
                NeededBloodBanks = patientCreateInputModel.NeededBloodBanks,
            };

            await this.patientService.CreateAsync(model);

            return(this.Redirect("/"));
        }
Beispiel #2
0
        public IActionResult BecomePatient()
        {
            var cities     = this.cityService.AllCities().Result;
            var inputModel = new PatientsCreateInputModel
            {
                Cities = cities,
            };

            return(this.View(inputModel));
        }