Esempio n. 1
0
        public async Task <IActionResult> EditVacancy(Guid client, VacancyUpdateModel model)
        {
            if (ModelState.IsValid)
            {
                var cmd    = new UpdateVacancyCommand(model.Id, client, model.Title, model.Description, model.OpenDate, model.CloseDate);
                var result = await _mediator.Send(cmd);

                if (result.IsFailure)
                {
                    ModelState.AddModelError("", result.Error);
                }
                else
                {
                    return(RedirectToAction(nameof(ClientController.Vacancies), new { client }));
                }
            }

            return(View(model));
        }
 public async Task <Guid> UpdateVacancyAsync([FromBody] UpdateVacancyCommand request)
 => await _mediator.Send(request);