// GET: Status/Create public async Task <IActionResult> Create() { var pessoa = await _pessoaService.FindAllAsync(); var status = await _statusService.FindAllAsync(); var viewModel = new OsFormViewModel { Pessoa = pessoa, Status = status }; return(View(viewModel)); }
public async Task <IActionResult> Create(OS os) { if (!ModelState.IsValid) { var pessoa = await _pessoaService.FindAllAsync(); var status = await _statusService.FindAllAsync(); var viewModel = new OsFormViewModel { Os = os, Pessoa = pessoa, Status = status }; return(View(viewModel)); } await _osService.InsertAsync(os); return(RedirectToAction(nameof(Index))); }