Example #1
0
        public async Task <IActionResult> Index([FromBody] object config)
        {
            ConfigurationViewModel configurationViewModel = JsonConvert.DeserializeObject <ConfigurationViewModel>(config.ToString());

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

            if (!configurationViewModel.Id.Equals(Guid.Empty))
            {
                await _configurationAppService.Update(configurationViewModel);
            }

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

            HttpContext.Response.StatusCode = 200;

            return(RedirectToAction("Index", "Lottery"));
        }
        public async Task <IActionResult> Put([FromBody] ConfigurationViewModel model)
        {
            await _configurationAppService.Update(model);

            return(Accepted());
        }