main
1using System.Collections.Generic;
2using MoMoney.DTO;
3using MoMoney.Presentation.Core;
4using MoMoney.Presentation.Views;
5using MoMoney.Service.Contracts.Application;
6
7namespace MoMoney.Presentation.Presenters
8{
9 public interface IAddCompanyPresenter : IContentPresenter
10 {
11 void submit(RegisterNewCompany dto);
12 }
13
14 public class AddCompanyPresenter : ContentPresenter<IAddCompanyView>, IAddCompanyPresenter
15 {
16 readonly ICommandPump pump;
17
18 public AddCompanyPresenter(IAddCompanyView view, ICommandPump pump) : base(view)
19 {
20 this.pump = pump;
21 }
22
23 public override void run()
24 {
25 view.attach_to(this);
26 pump.run<IEnumerable<CompanyDTO>, IGetAllCompanysQuery>(view);
27 }
28
29 public void submit(RegisterNewCompany dto)
30 {
31 pump
32 .run<IRegisterNewCompanyCommand, RegisterNewCompany>(dto)
33 .run<IEnumerable<CompanyDTO>, IGetAllCompanysQuery>(view);
34 }
35 }
36}