public async Task <IActionResult> Edit(int id)
        {
            if (id == null)
            {
                return(this.NotFound());
            }

            var symptom = await this.db.Symptoms.FindAsync(id);

            if (symptom == null)
            {
                return(this.NotFound());
            }

            var bodySystemsDrop = await this.bodySystemsService
                                  .BodySystemDropDownMenu <BodySystemsDropDownViewModel>();

            var symptomInput = new SymptomsInputViewModel
            {
                SymptomId    = id,
                Description  = symptom.Description,
                BodySystemId = symptom.BodySystemId,
                bodySystems  = bodySystemsDrop,
            };

            return(this.View(symptomInput));
        }
        public async Task <IActionResult> Create(SymptomsInputViewModel symptomsInput)
        {
            await this.symptomsService.CreateSymptomAsync(symptomsInput.Description, symptomsInput.BodySystemId);

            this.TempData["CreatedSymptom"] = $"You have successfully created this symptom!";

            return(this.RedirectToAction("Index"));
        }
        public async Task <IActionResult> Create()
        {
            var bodySystemsDrop = await this.bodySystemsService
                                  .BodySystemDropDownMenu <BodySystemsDropDownViewModel>();

            var symptomsInput = new SymptomsInputViewModel
            {
                bodySystems = bodySystemsDrop,
            };

            return(this.View(symptomsInput));
        }
        public async Task <IActionResult> Edit(
            int id,
            [Bind("SymptomId,Description,BodySystemId")] SymptomsInputViewModel symptomInput)
        {
            if (id != symptomInput.SymptomId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await this.symptomsService.ModifySymptomAsync(
                        symptomInput.SymptomId,
                        symptomInput.Description,
                        symptomInput.BodySystemId);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (await this.symptomsService.GetModelByIdAsync <SymptomsAdminDetailsViewModel>(id) == null)
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw new Exception("A problem occurred while trying to edit this symptom.");
                    }
                }

                this.TempData["ModifiedSymptom"] = $"You have successfully modified this symptom!";

                return(this.RedirectToAction("Index"));
            }

            return(View(symptomInput));
        }