private void Edit(BetDisplayModel betDisplayModel) { BetInfoViewModel viewModel = new BetInfoViewModel(betDisplayModel); BetInfoControl control = new BetInfoControl(viewModel); Window window = WindowFactory.CreateByContentsSize(control); viewModel.BetEdited += (s, e) => { BetEditModel betEditModel = e.Bet; BetEditDTO betEditDTO = Mapper.Map <BetEditModel, BetEditDTO>(betEditModel); using (IBetService service = factory.CreateBetService()) { ServiceMessage serviceMessage = service.Update(betEditDTO); RaiseReceivedMessageEvent(serviceMessage); if (serviceMessage.IsSuccessful) { window.Close(); Notify(); } } }; window.Show(); }
public BetInfoControl(BetInfoViewModel viewModel) { InitializeComponent(); this.DataContext = viewModel; }