Ejemplo n.º 1
0
        public async Task <IActionResult> EditDescriptionGroup(DescriptionGroupDto descriptionGroupDto)
        {
            if (descriptionGroupDto == null)
            {
                return(RedirectToAction("DescriptionGroups"));
            }

            var descriptionGroup = _mapper.Map <DescriptionGroup>(descriptionGroupDto);

            OperationResult result = await _shopManager.UpdateDescriptionGroupAsync(descriptionGroup);

            if (!result.Succeeded)
            {
                TempData["Message"] = string.Join(Environment.NewLine, result.Errors.Select(x => x.Description));
            }
            else
            {
                TempData["Message"] = $"Группа \"{descriptionGroupDto.Name}\" успешно изменена.";
            }

            return(RedirectToAction("DescriptionGroups"));
        }