public IActionResult Edit([Bind] VacancyResponse vacancyData)
        {
            if (!ModelState.IsValid)
            {
                var vacancy = VacancyService.Get(vacancyData.Id);
                vacancyData.Organization = vacancy.Organization.ToResponse();
                return(View(vacancyData));
            }

            var storedModel   = VacancyService.Get(vacancyData.Id);
            var updateRequest = storedModel.ToUpdateCommandBy(vacancyData);

            var updated = VacancyService.Update(vacancyData.Id, updateRequest);

            var expectedUpdated = vacancyData.ToModel();
            var success         = updated.IsIdenticTo(expectedUpdated);

            var model = new IndexPageStatusModel
            {
                StatusId  = $"{nameof(Edit)}:{success}",
                VacancyId = vacancyData.Id
            };

            return(RedirectToAction(nameof(Index), model));
        }
        public IActionResult Index([Bind] IndexPageStatusModel pageStatusModel = null)
        {
            var dataModel = new IndexDataModel
            {
                Data   = GetAllVacancies(),
                Status = pageStatusModel.ToStatus(VacancyIndexPageStatuses.Data)
            };

            return(View(dataModel));
        }
        public IActionResult DeleteComfirmed([Bind] string id)
        {
            var success = VacancyService.Delete(id);

            var model = new IndexPageStatusModel
            {
                StatusId  = $"{nameof(Edit)}:{success}",
                VacancyId = id
            };

            return(RedirectToAction(nameof(Index), model));
        }
        public IActionResult Create([Bind] VacancyCreateModel vacancyData)
        {
            if (!ModelState.IsValid)
            {
                return(View(vacancyData));
            }

            var id      = VacancyService.Add(vacancyData.ToModel(OrganizationService));
            var success = id != null && id != Guid.Empty.ToString();

            var model = new IndexPageStatusModel
            {
                StatusId  = $"{nameof(Create)}:{success}",
                VacancyId = id
            };

            return(RedirectToAction(nameof(Index), model));
        }