Beispiel #1
0
        public async Task <IActionResult> Create()
        {
            ConfigGeneralFormViewModel viewModel = null;
            await Task.Run(() => {
                viewModel = new ConfigGeneralFormViewModel {
                };
            });

            return(View(viewModel));
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(int id)
        {
            if (id == 0)
            {
                return(NotFound());
            }

            var configGeneral = await _configGeneralService.FindByIdAsync(id);

            var viewModel = new ConfigGeneralFormViewModel {
                ConfigGeneral = configGeneral
            };

            return(View(viewModel));
        }
Beispiel #3
0
        public async Task <IActionResult> Edit(ConfigGeneral configGeneral)
        {
            if (!ModelState.IsValid)
            {
                var viewModel = new ConfigGeneralFormViewModel {
                    ConfigGeneral = configGeneral
                };

                return(View(viewModel));
            }

            await _configGeneralService.EditAsync(configGeneral);

            return(RedirectToAction("Visualizar"));
        }
Beispiel #4
0
        public async Task <IActionResult> Create(ConfigGeneral configGeneral)
        {
            if (!ModelState.IsValid)
            {
                var viewModel = new ConfigGeneralFormViewModel {
                    ConfigGeneral = configGeneral
                };

                return(View(viewModel));
            }

            await _configGeneralService.InsertAsync(configGeneral);

            return(RedirectToAction(nameof(Index), "Home"));
        }