public JsonResult getPaginatore(FilterModelView filtri) { var model = db.Users.Where(x => x.Email != "*****@*****.**") .ToList() .Select(x => { return(new UtentiView() { Id = x.Id, UserName = x.UserName }); }); if (!string.IsNullOrEmpty(filtri.username)) { model = model.Where(x => x.UserName.Contains(filtri.username)); } int count = model.Count(); filtri.rec_number = count; filtri.rec_x_pagina = REC_X_PAGINA; filtri.pag_number = Math.Ceiling(1.0 * count / REC_X_PAGINA); return(Json(filtri, JsonRequestBehavior.AllowGet)); }
private IQueryable <ma_articoli> GetArticoli(FilterModelView filtri) { var model = from m in db.ma_articoli select m; if (!string.IsNullOrEmpty(filtri.cat)) { model = model.Where(x => x.id_categoria.Contains(filtri.cat)); } if (!string.IsNullOrEmpty(filtri.key)) { model = CommonHelper.LikeResult(model, filtri.key, "descrizione_it"); } if (!filtri.online) { model = model.Where(x => x.online == false); } else { model = model.Where(x => x.online == true); } return(model); }
public JsonResult getContenutoPagina(FilterModelView filtri) { var model = db.Users.Where(x => x.Email != "*****@*****.**") .ToList() .Select(x => { return(new UtentiView() { Id = x.Id, UserName = x.UserName, AccessFailedCount = x.AccessFailedCount, LockoutEnabled = x.LockoutEnabled, Roles = GetRoles(x.Id) }); }); if (!string.IsNullOrEmpty(filtri.username)) { model = model.Where(x => x.UserName.Contains(filtri.username.ToLower())); } model = model .OrderBy(x => x.Id) .Skip(filtri.page_number * REC_X_PAGINA) .Take(REC_X_PAGINA); return(Json(model, JsonRequestBehavior.AllowGet)); }
public JsonResult getContenutoPagina(FilterModelView filtri) { var result = GetArticoli(filtri) .ToList() .Select(x => { return(new ItemModelView() { anno = x.anno_produzione.ToString(), articolo = x.articolo, id_articolo = x.id_articolo, categoria = currentCulture == "en" ? x.mc_cat_merc.descrizione_en : x.mc_cat_merc.descrizione_it, data_pubblicazione = x.data_pubblicazione.ToString("yyyy-MM-dd"), descrizione = currentCulture == "en" ? x.descrizione_en : x.descrizione_it, id_categoria = x.id_categoria, ore = x.ore_di_lavoro.ToString(), peso = x.peso.ToString(), produttore = x.produttore, conta_visite = x.ma_articoli_view.visite.ToString(), conta_img = x.ma_articoli_img.Count().ToString(), img = CommonHelper.getImgArt(x, Url.Content("~/public/media/ads/")) }); }); return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult getContenutoPagina(FilterModelView filtri) { var result = GetArticoli(filtri) .ToList() .Select(x => { return(new ItemModelView() { anno = x.anno_produzione.ToString(), articolo = x.articolo, id_articolo = x.id_articolo, categoria = x.mc_cat_merc.descrizione_it, data_pubblicazione = x.data_pubblicazione.ToString("yyyy-MM-dd"), id_categoria = x.id_categoria, ore = x.ore_di_lavoro.ToString(), peso = x.peso.ToString(), produttore = x.produttore, conta_visite = x.ma_articoli_view.visite.ToString(), conta_img = x.ma_articoli_img.Count().ToString(), img = CommonHelper.getImgArt(x, Url.Content("~/public/media/ads/")), descrizione_en = x.descrizione_en, descrizione_it = x.descrizione_it, id_utente = x.id_utente, online = x.online, prezzo_di_vendita = CommonHelper.setDecimal(x.prezzo_di_vendita), prezzo_richiesto = CommonHelper.setDecimal(x.prezzo_richiesto), valuta = x.valuta, venduto = x.venduto }); }); return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult getPaginatore(FilterModelView filtri) { int count = GetArticoli(filtri).Count(); filtri.rec_number = count; filtri.rec_x_pagina = REC_X_PAGINA; filtri.pag_number = Math.Ceiling(1.0 * count / REC_X_PAGINA); return(Json(filtri, JsonRequestBehavior.AllowGet)); }
private IQueryable <mc_cat_merc> GetCategorie(FilterModelView filtri) { var model = from c in db.mc_cat_merc select c; if (!string.IsNullOrEmpty(filtri.cat)) { model = CommonHelper.LikeResult(model, filtri.cat, "descrizione_it"); } return(model); }
/// <summary> /// /// </summary> /// <returns></returns> private IQueryable <ma_articoli> GetArticoli(FilterModelView filtri) { string descrizioneLike = currentCulture == "en" ? "descrizione_en" : "descrizione_it"; var model = from m in db.ma_articoli where m.online == true & m.venduto == false select m; if (!string.IsNullOrEmpty(filtri.cat)) { model = model.Where(x => x.id_categoria.Contains(filtri.cat)); } if (!string.IsNullOrEmpty(filtri.key)) { model = CommonHelper.LikeResult(model, filtri.key, descrizioneLike); } return(model); }
public JsonResult getContenutoPagina(FilterModelView filtri) { var result = GetCategorie(filtri) .ToList() .Select(x => { return(new CategorieModelView() { livello = CommonHelper.setInt(x.livello), chiave = x.chiave, descrizione_en = x.descrizione_en, descrizione_it = x.descrizione_it, id_categoria = x.id_categoria, id_categoria_padre = x.id_categoria_padre }); }); return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult Index(FilterModelView filtri) { return(View(filtri)); }