// GET: Venta public async Task <IActionResult> Index() { try { ViewBag.CantidadAlarmas = (await productoRepository.GetCantidadAlarmas()).Cantidad; return(View(await ventaRepository.GetAll())); } catch (Exception e) { return(StatusCode((int)System.Net.HttpStatusCode.Unauthorized, e.Message)); //return Unauthorized(e.Message); } }
// GET: Trabajador public async Task <IActionResult> Index() { try { List <TrabajadorViewModel>?trabajadores = await trabajadorRepository.GetAllTrabajadorNegocio(); ViewBag.CantidadAlarmas = (await productoRepository.GetCantidadAlarmas()).Cantidad; return(View(trabajadores)); } catch (Exception e) { return(StatusCode((int)System.Net.HttpStatusCode.Unauthorized, e.Message)); //return Unauthorized(e.Message); } }
public async Task <IActionResult> Index() { try { ViewBag.CantidadAlarmas = (await productoRepository.GetCantidadAlarmas()).Cantidad; ViewBag.CantidadProdCate = await CantProdCate(); var cant = await CantTotalDashboard(); if (cant.cantcate != null && cant.cantprod != null && cant.preciototal != null) { ViewBag.TotalDashboard = cant; } else { cant.cantcate = 0; cant.cantprod = 0; cant.preciototal = 0; ViewBag.TotalDashboard = cant; } return(View()); } catch (Exception e) { return(StatusCode((int)System.Net.HttpStatusCode.Unauthorized, e.Message)); //return Unauthorized(e.Message); } }
// GET: Optimizar public async Task <IActionResult> Index() { try { if (!(await trabajadorRepository.EsJefe()).Item2) { return(Unauthorized("No tiene permisos para ver este contenido.")); } ViewBag.CantidadAlarmas = (await producto.GetCantidadAlarmas()).Cantidad; return(View()); } catch (Exception e) { return(StatusCode((int)System.Net.HttpStatusCode.Unauthorized, e.Message)); //return Unauthorized(e.Message); } }
public async Task <IActionResult> Profile() { try { ViewBag.CantidadAlarmas = (await productoRepository.GetCantidadAlarmas()).Cantidad; var trabajador = await repositorioTrabajadores.GetCurrentTrabajador(); if (trabajador == null) { await LogoutAsync(); } var negocio = await repNegocio.GetById(trabajador !.IdNegocio); if (trabajador.Foto != null) { ViewData["img"] = string.Format(config["AWSS3:UrlUser"], trabajador.IdNegocio, trabajador.Rut); } return(View(new TrabajadorUpdateViewModel { Correo = trabajador.Correo, Rut = trabajador.Rut, Nombre = trabajador.Nombre, Apellido = trabajador.Apellido, FechaNacimiento = trabajador.FechaNacimiento, Telefono = trabajador.Telefono, FotoUrl = trabajador.Foto, NombreNegocio = negocio.Nombre })); } catch (Exception e) { return(StatusCode((int)System.Net.HttpStatusCode.Unauthorized, e.Message)); //return Unauthorized(e.Message); } }