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

            var change = await _bll.ChangeService.GetChangeAsync(changeId : id.Value);

            if (change == null)
            {
                return(NotFound());
            }

            var categories =
                (await _bll.OrganizationsService.GetOrganizationWithCategoriesAsync(change.OrganizationId)).Categories;

            var selectedCategoryIds = change.Categories.Select(dto => dto.Id).ToList();
            var vm = new EditChangeViewModel()
            {
                Price          = change.CurrentPrice,
                ChangeId       = change.Id,
                OrganizationId = change.OrganizationId,
                ChangeName     = change.Name,
                Categories     = categories.Select(dto =>
                                                   new SelectListItem(dto.CategoryName, dto.CategoryId.ToString(), selectedCategoryIds.Contains(dto.CategoryId)))
                                 .ToList()
            };

            vm.Categories.Sort((item, item2) => int.Parse(item.Value).CompareTo(int.Parse(item2.Value)));
            return(View(vm));
        }
        public async Task <IActionResult> Edit(EditChangeViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var input = new BLLChangeDTO()
                {
                    Id             = vm.ChangeId,
                    OrganizationId = vm.OrganizationId,
                    CurrentPrice   = vm.Price,
                    Name           = vm.ChangeName,
                    Categories     = vm.SelectedCategories.Select(i => new BLLCategoryMinDTO(i)).ToList()
                };

                var result = await _bll.ChangeService.EditChange(input);

                if (result == false)
                {
                    return(BadRequest());
                }
                return(RedirectToAction("Organization", "Dashboard", new { Id = vm.OrganizationId }));
            }
            return(BadRequest());
        }