public ContactEditorViewModel(ICommandInvoker commandInvoker, IQueryInvoker queryInvoker)
        {
            this.queryInvoker = queryInvoker;
            Contacts = queryInvoker.Query<AllContactsQueryResult>().Contacts;

            SaveCommand = new DelegateCommand(() =>
                {
                    if (CurrentContact.Command is UpdateContactCommand)
                    {
                        commandInvoker.Execute<UpdateContactCommand, UpdateContactQueryResult>((UpdateContactCommand) CurrentContact.Command);
                    }
                    else
                    {
                        commandInvoker.Execute<CreateContactCommand, CreateContactQueryResult>(CurrentContact.Command);
                    }

                    Contacts = queryInvoker.Query<AllContactsQueryResult>().Contacts;
                });

            NewCommand = new DelegateCommand(() =>
                {
                    var modifyContactQueryResult = queryInvoker.Query<CreateContactQueryResult>();
                    CurrentContact = new CreateContactViewModel(modifyContactQueryResult, new ValidationService());
                });
            NewCommand.Execute(null);
        }
Пример #2
0
        public ContactController()
        {
            // You'd really DI this is from autofac.
            var contactService = new ContactService(new CountyRepository(),
                                                      new CountryRepository(),
                                                      new ContactRepository(),
                                                      new ValidationService(),
                                                      new ContactAdministrationService(new CountyRepository(),
                                                                                       new CountryRepository(),
                                                                                       new ContactRepository()));

            commandInvoker = new CommandInvoker(contactService);
            queryInvoker = new QueryInvoker(contactService);
        }
Пример #3
0
        /// <summary>
        /// Controller to manage order entities.
        /// </summary>

        public OrdersController(ICommandInvoker commandInvoker, IQueryInvoker queryInvoker, IMapper mapper)
        {
            _commandInvoker = commandInvoker;
            _queryInvoker   = queryInvoker;
            _mapper         = mapper;
        }
Пример #4
0
 protected QueryController(IQueryInvoker queryInvoker)
 {
     this.queryInvoker = queryInvoker;
 }
Пример #5
0
 public MenuQueryHandler(IQueryInvoker queryInvoker)
 {
     this.query = queryInvoker;
 }
 public TestQueryController(IQueryInvoker commandInvoker) : base(commandInvoker)
 {
 }
Пример #7
0
 public PropertyQueryHandler(IQueryInvoker queryInvoker)
 {
     this.query = queryInvoker;
 }
Пример #8
0
 /// <summary>
 /// Controller to manage inventory entities: articles, bill of materials and spoilage.
 /// </summary>
 /// <param name="commandInvoker"></param>
 /// <param name="queryInvoker"></param>
 /// <param name="mapper"></param>
 public InventoryController(ICommandInvoker commandInvoker, IQueryInvoker queryInvoker, IMapper mapper)
 {
     _commandInvoker = commandInvoker;
     _queryInvoker   = queryInvoker;
     _mapper         = mapper;
 }
Пример #9
0
 /// <summary>
 /// Controller to manage shop category entities.
 /// </summary>
 public ShopCategoriesController(ICommandInvoker commandInvoker, IQueryInvoker queryInvoker, IMapper mapper)
 {
     _commandInvoker = commandInvoker;
     _queryInvoker   = queryInvoker;
     _mapper         = mapper;
 }