public JsonResult Tendencia(LikesUsuario like) { CatalogoCore core = new CatalogoCore(); switch (Request.HttpMethod) { case "POST": return(Json(core.GuardarLike(like))); } return(Json(new { Error = true, Message = "Operación HTTP desconocida" })); }
public JsonResult ObtTendenciaApp(int app) { List <LikesUsuario> likes = new List <LikesUsuario>(); List <Tendencia> tendencias = new List <Tendencia>(); CatalogoCore catalogoCore = new CatalogoCore(); likes = catalogoCore.ObtTendenciaPorApp(app); var trends = likes.GroupBy(s => s.IdProducto); if (trends.Count() > 0) { foreach (var item in trends) { tendencias.Add(new Tendencia { IdProducto = item.Key, CantidadLikes = item.Count() }); } } return(Json(tendencias.OrderBy(s => s.CantidadLikes), JsonRequestBehavior.AllowGet)); }