コード例 #1
0
        public UIElement GetAddElement()
        {
            SportCreateViewModel viewModel = new SportCreateViewModel();
            SportCreateControl   control   = new SportCreateControl(viewModel);

            viewModel.SportCreated += (s, e) =>
            {
                SportCreateModel sportCreateModel = e.Sport;
                SportCreateDTO   sportCreateDTO   = Mapper.Map <SportCreateModel, SportCreateDTO>(sportCreateModel);

                using (ISportService service = factory.CreateSportService())
                {
                    ServiceMessage serviceMessage = service.Create(sportCreateDTO);
                    RaiseReceivedMessageEvent(serviceMessage.IsSuccessful, serviceMessage.Message);

                    if (serviceMessage.IsSuccessful)
                    {
                        viewModel.SportName = String.Empty;
                        Notify();
                    }
                }
            };

            return(control);
        }
コード例 #2
0
 public async Task <IActionResult> Create(SportDto SportDto)
 {
     return(Ok(new { Success = true, SportId = await _sportService.Create(SportDto) }));
 }