コード例 #1
0
        public override void Handle(EditThemeCommand command)
        {
            Theme themeToChange = _dbContext.Themes.Find(command.Id);

            if (themeToChange == null)
            {
                _result = new InvalidResult()
                          .WithError("No theme of this id has been found.");
            }

            Theme parent = _dbContext.Themes.Find(command.ParentId);

            themeToChange.ChangeName(command.Name);
            themeToChange.ChangeParent(parent);

            _dbContext.Themes.Update(themeToChange);
            _dbContext.SaveChanges();
            _result = new SuccessResult();
        }