コード例 #1
0
        public ICommandResult Handle(UpdateSingerCommand command)
        {
            var name   = new Name(command.FirstName, command.LastName);
            var singer = new Singer(command.Id, name, command.Nationality, command.About, command.Image);

            AddNotifications(name.Notifications);
            AddNotifications(singer.Notifications);

            if (Invalid)
            {
                return(new CommandResult(false, "Falha ao atualizar cantor", Notifications));
            }

            bool result = _repository.Update(singer);

            if (!result)
            {
                return(new CommandResult(false, "Falha ao atualizar cantor"));
            }

            return(new CommandResult(true, "Cantor atualizado com sucesso"));
        }
コード例 #2
0
 public ICommandResult Update([FromBody] UpdateSingerCommand command)
 {
     return(_handler.Handle(command));
 }