示例#1
0
        public async Task <IActionResult> DeleteDescriptionGroupConfirm(DescriptionGroupDto descriptionGroupDto)
        {
            if (descriptionGroupDto == null)
            {
                return(RedirectToAction("DescriptionGroups"));
            }

            var result = await _shopManager.DeleteDescriptionGroupAsync(descriptionGroupDto.Id.GetValueOrDefault());

            if (!result.Succeeded)
            {
                foreach (var error in result.Errors)
                {
                    ModelState.AddModelError(error.Code, error.Description);
                }

                return(View("DeleteDescriptionGroup", descriptionGroupDto));
            }

            TempData["Message"] = $"Категория \"{descriptionGroupDto.Name}\" успешно удалена.";
            return(RedirectToAction("DescriptionGroups"));
        }