public async Task <IActionResult> Create(int inventarioId) { var inventario = await _inventarioService.FindByIdAsync(EmpresaId, inventarioId); var inventarioItens = await _inventarioItemService.FindByInventarioIdAsync(EmpresaId, inventarioId); var produtos = await _produtoService.FindAllAsync(EmpresaId); var viewModel = new InventarioItensFormViewModel { Inventario = inventario, InventarioItens = inventarioItens, Produtos = produtos }; return(View(viewModel)); }
public async Task <IActionResult> Details(int?id) { if (id == null) { return(RedirectToAction(nameof(Error), new { message = "Id não infomado!" })); } var obj = await _inventarioService.FindByIdAsync(EmpresaId, id.Value); if (obj == null) { return(RedirectToAction(nameof(Error), new { message = "Id não encontrado!" })); } var inventarioItens = await _inventarioItemService.FindByInventarioIdAsync(EmpresaId, int.Parse(id.ToString())); var viewModel = new InventarioFormViewModel { Inventario = obj, InventarioItens = inventarioItens }; return(View(viewModel)); }