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); }
public async Task <IActionResult> Create(SportDto SportDto) { return(Ok(new { Success = true, SportId = await _sportService.Create(SportDto) })); }