public async Task <IActionResult> Index()
        {
            CapacitacionesViewModel model = new CapacitacionesViewModel();

            var user = await _userHelper.GetUserAsync(this.User.Identity.Name);

            if (user != null)
            {
                //if (this.User.IsInRole("Cliente"))
                //{
                //    model = await _capacitacionesRepository.GetAnalisis(user.Cedula);
                //}
                //else
                //{

                //}
                await _logRepository.SaveLogs("Get", "Obtiene lista de Capacitaciones", "Capacitaciones", User.Identity.Name);

                model = await _capacitacionesRepository.GetCapacitacionesAsync();
            }

            //ViewBag.ClienteViewModel = await _datosRepository.GetDatosCliente(user.Cedula);

            return(View(model));
        }
Beispiel #2
0
        public async Task <CapacitacionesViewModel> GetCapacitacionesAsync()
        {
            CapacitacionesViewModel capacitacionesViewModel = new CapacitacionesViewModel();

            List <Capacitacion> capacitaciones = await _dataContext.capacitaciones
                                                 .Include(t => t.tipoCapacitacion)
                                                 .Include(a => a.archivoCapacitaciones)
                                                 .Include(u => u.user)
                                                 //.ThenInclude(l=>l.tipo)
                                                 //.Where(c => c.Cedula == cedula)
                                                 .OrderByDescending(o => o.Fecha).ToListAsync();

            //capacitacionesViewModel.cedula = cedula;
            capacitacionesViewModel.capacitaciones = capacitaciones;

            return(capacitacionesViewModel);
            //throw new NotImplementedException();
        }