public IActionResult Index([FromBody] object TypeLottery)
        {
            TypeLotteryViewModel TypeLotteryViewModel = JsonConvert.DeserializeObject <TypeLotteryViewModel>(TypeLottery.ToString());

            if (!ModelState.IsValid)
            {
                return(View(TypeLotteryViewModel));
            }

            if (!TypeLotteryViewModel.Id.Equals(Guid.Empty))
            {
                _TypeLotteryAppService.Update(TypeLotteryViewModel);
            }
            else
            {
                _TypeLotteryAppService.Register(TypeLotteryViewModel);
            }

            if (IsValidOperation())
            {
                ViewBag.Sucesso = "Atualizado com sucesso!";
            }

            return(View());
        }
Exemplo n.º 2
0
        public void Update(TypeLotteryViewModel TypeLotteryViewModel)
        {
            var updateCommand = _mapper.Map <UpdateTypeLotteryCommand>(TypeLotteryViewModel);

            Bus.SendCommand(updateCommand);
        }
Exemplo n.º 3
0
        public void Register(TypeLotteryViewModel TypeLotteryViewModel)
        {
            var registerCommand = _mapper.Map <RegisterNewTypeLotteryCommand>(TypeLotteryViewModel);

            Bus.SendCommand(registerCommand);
        }