public ActionResult Index() { if (TempData["MsjExito"] != null) { ViewBag.MsjExito = TempData["MsjExito"]; TempData["MsjExito"] = null; } Models.HomeModels hm = new Models.HomeModels(); hm.CantidadPremiosCanjeados = db.canje_premios.Count(c => c.socio_id == IdSocioIdentity); hm.PuntosDisponibles = (int)db.socios.Find(IdSocioIdentity).puntos_actuales; try { hm.UltimaCargaDePuntos = db.carga_puntos.Where(s => s.socio_id == IdSocioIdentity).Max(c => c.fecha_alta).ToShortDateString(); } catch (InvalidOperationException) { hm.UltimaCargaDePuntos = "Sin Cargas"; } try { hm.UltimoPremioCanjeado = db.canje_premios.Where(c => c.socio_id == IdSocioIdentity).OrderByDescending(c => c.fecha_alta).First().premio.nombre; } catch (InvalidOperationException) { hm.UltimoPremioCanjeado = "Sin Premios"; } return(View(hm)); }
public ActionResult ENIndex() { Models.HomeModels home = new Models.HomeModels(); home.Categories = db.Category.ToList(); home.Foods = db.Food.ToList(); home.Title = db.Settings.FirstOrDefault(x => x.ID == 1).en_Title; return(View(home)); }