// GET: Outlays/Details/5 public async Task <IActionResult> Details(int?id) { GetSessions(); if (ViewBag.Email == null) { return(ExpiredSession()); } if (id == null) { return(NotFound()); } int AcessLevel = ViewBag.AcessLevel; int employeeId = ViewBag.id; var outlays = await _context.Outlays .FirstOrDefaultAsync(m => m.Id == id); //var employees = _employeeService.FindAllAsync(); var projects = await _projectService.FindProjectAsync(ViewBag.Id, ViewBag.AcessLevel); var clients = await _clienteService.FindAllAsync(AcessLevel, employeeId); var ViewModel = new OutlaysFormViewModel { Clients = clients, Projects = projects, Outlays = outlays }; if (outlays == null) { return(NotFound()); } return(View(ViewModel)); }
// GET: Outlays/Create public async Task <IActionResult> Create(int?status, int?clients, int?projects, int?employees, int?month, int?year) { GetSessions(); if (ViewBag.Email == null) { return(ExpiredSession()); } int AcessLevel = ViewBag.AcessLevel; int employeeId = ViewBag.id; ViewBag.Month = month; ViewBag.Year = year; ViewBag.Status = status; ViewBag.Clients = clients; ViewBag.Projects = projects; ViewBag.Employees = employees; //var employees = _employeeService.FindAllAsync(); var projetos = await _projectService.FindProjectAsync(ViewBag.Id, ViewBag.AcessLevel); var clientes = await _clienteService.FindAllAsync(AcessLevel, employeeId); var ViewModel = new OutlaysFormViewModel { Clients = clientes, Projects = projetos }; return(View(ViewModel)); }
// GET: Outlays public async Task <IActionResult> Index(int?status, int?clients, int?projects, int?employees, int?month, int?year) { GetSessions(); if (ViewBag.Email == null) { return(ExpiredSession()); } int empId = ViewBag.Id; var accessLevel = ViewBag.AcessLevel; var despesas = await _outlaysService.FindAllAsync(empId, status, clients, projects, employees, month, year); var clientes = await _clienteService.FindAllAsync(accessLevel, empId); var projetos = await _projectService.FindProjectAsync(empId, accessLevel); var funcionarios = await _employeeService.FindAllAsync(); var viewModel = new OutlaysFormViewModel { Outlay = despesas, Projects = projetos, Employees = funcionarios, Clients = clientes }; ViewBag.Month = month; ViewBag.Year = year; ViewBag.Status = status; ViewBag.Clients = clients; ViewBag.Projects = projects; ViewBag.Employees = employees; return(View(viewModel)); }
// GET: Outlays/Details/5 public async Task <IActionResult> Details(int?id, int?status, int?clients, int?projects, int?employees, int?month, int?year) { GetSessions(); if (ViewBag.Email == null) { return(ExpiredSession()); } if (id == null) { return(NotFound()); } int AcessLevel = ViewBag.AcessLevel; int employeeId = ViewBag.id; ViewBag.Month = month; ViewBag.Year = year; ViewBag.Status = status; ViewBag.Clients = clients; ViewBag.Projects = projects; ViewBag.Employees = employees; var outlays = await _context.Outlays .FirstOrDefaultAsync(m => m.Id == id); var funcionarios = await _employeeService.FindAllAsync(); var projetos = await _projectService.FindAllAsync(); var clientes = await _clienteService.FindAllAsync(AcessLevel, employeeId); var ViewModel = new OutlaysFormViewModel { Clients = clientes, Projects = projetos, Employees = funcionarios, Outlays = outlays }; if (outlays == null) { return(NotFound()); } return(View(ViewModel)); }