public async Task <IActionResult> MakeAppointment(MakeAppointmentModel model)
        {
            if (ModelState.IsValid)
            {
                var cmd    = new MakeAppointmentCommand(model.AppointmentType, model.StartsAt, model.CandidateId, model.VacancyId);
                var result = await _mediator.Send(cmd);

                if (result.IsFailure)
                {
                    ModelState.AddModelError("", result.Error);
                }
                else
                {
                    return(RedirectToAction(nameof(AppointmentController.Index)));
                }
            }

            var candidates = await _mediator.Send(new GetCandidateDropQuery());

            var vacancies = await _mediator.Send(new GetVacanciesDropQuery());

            ViewBag.AppointmentTypes = new SelectList(Enum.GetValues(typeof(AppointmentType)).Cast <AppointmentType>());

            model.Candidates = new SelectList(candidates, "Id", "Text", model.CandidateId);
            model.Vacancies  = new SelectList(vacancies, "Id", "Text", model.VacancyId);

            return(View(model));
        }
        public async Task <IActionResult> MakeAppointment()
        {
            var candidates = await _mediator.Send(new GetCandidateDropQuery());

            var vacancies = await _mediator.Send(new GetVacanciesDropQuery());

            ViewBag.AppointmentTypes = new SelectList(Enum.GetValues(typeof(AppointmentType)).Cast <AppointmentType>());

            var vm = new MakeAppointmentModel
            {
                StartsAt   = DateTime.Now,
                Candidates = new SelectList(candidates, "Id", "Text"),
                Vacancies  = new SelectList(vacancies, "Id", "Text")
            };

            return(View(vm));
        }