public async Task <IActionResult> Create() { ConfigGeneralFormViewModel viewModel = null; await Task.Run(() => { viewModel = new ConfigGeneralFormViewModel { }; }); return(View(viewModel)); }
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)); }
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")); }
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")); }