public async Task <ActionResult> GetAgendas() { var identity = (ClaimsPrincipal)Thread.CurrentPrincipal; var sid = identity.Claims.Where(c => c.Type == ClaimTypes.NameIdentifier) .Select(c => c.Value).SingleOrDefault(); Guid userId = new Guid(sid); List <Agendas> result = await agendaService.GetAll().Include(x => x.AgendaUsuario).Where(x => x.AgendaUsuario.Where(s => s.UsuarioId == userId).Count() > 0).ToListAsync(); return(Json(Mapper.Map <List <AgendasViewModel> >(result), JsonRequestBehavior.AllowGet)); }
public override void OnBeginIndex() { ViewBag.Personas = personaService.GetAll().Count(); ViewBag.Usuarios = usuarioService.GetAll().Count(); ViewBag.Agendas = agendaService.GetAll().Count(); ViewBag.Medicamentos = medicamentoService.GetAll().Count(); ViewBag.CitasAnteriorAnual = EntityService.GetAll().Where(x => x.AppointmentDate.Year == (DateTime.Now.Year - 1)).Count(); ViewBag.CitasActualesAnual = EntityService.GetAll().Where(x => x.AppointmentDate.Year == DateTime.Now.Year).Count(); ViewBag.CitasMesAnterior = EntityService.GetAll().Where(x => x.AppointmentDate.Month == (DateTime.Now.Month - 1) && x.AppointmentDate.Year == DateTime.Now.Year).Count(); ViewBag.CitasMesActual = EntityService.GetAll().Where(x => x.AppointmentDate.Month == DateTime.Now.Month && x.AppointmentDate.Year == DateTime.Now.Year).Count(); ViewBag.CitasAnteriorDias = EntityService.GetAll().Where(x => x.AppointmentDate.Day == (DateTime.Now.Day - 1) && x.AppointmentDate.Month == DateTime.Now.Month && x.AppointmentDate.Year == DateTime.Now.Year).Count(); ViewBag.CitasActualesDias = EntityService.GetAll().Where(x => x.AppointmentDate.Day == DateTime.Now.Day && x.AppointmentDate.Month == DateTime.Now.Month && x.AppointmentDate.Year == DateTime.Now.Year).Count(); }
public async Task <JsonResult> Get() { return(Json(Mapper.Map <List <AgendaDTO> >(await AgendaService.GetAll()), JsonRequestBehavior.AllowGet)); }