public async Task <JsonResult> ResultSearchOfferMultimedia_Jason(string town, string type, string brand, string modele, string capacity, int maxPrice) { SeachJobViewModel model = new SeachJobViewModel(); model.TypeMultimedia = type; model.TownMultimedia = town; model.BrandMultimedia = brand; model.ModelMultimedia = modele; model.PriceMultimedia = maxPrice; model.Capacity = capacity; model.CagtegorieSearch = "Multimedia"; model.SearchOrAskJobJob = "J'offre"; List <MultimediaModel> liste = await dal.GetListMultimediaWithNoInclude().Where(m => m.Category.CategoryName == model.CagtegorieSearch && m.SearchOrAskJob == model.SearchOrAskJobJob).ToListAsync(); if (!string.IsNullOrWhiteSpace(model.TownMultimedia)) { liste = liste.Where(m => m.Town == model.TownMultimedia).ToList(); } if (!string.IsNullOrWhiteSpace(model.TypeMultimedia)) { liste = liste.Where(m => m.Type == model.TypeMultimedia).ToList(); } if (!string.IsNullOrWhiteSpace(model.BrandMultimedia)) { liste = liste.Where(m => m.Brand == model.BrandMultimedia).ToList(); } if (!string.IsNullOrWhiteSpace(model.ModelMultimedia)) { liste = liste.Where(m => m.Model == model.ModelMultimedia).ToList(); } if (!string.IsNullOrWhiteSpace(model.Capacity)) { liste = liste.Where(m => m.Capacity == model.Capacity).ToList(); } if (model.PriceMultimedia > 0) { liste = liste.Where(m => m.Price < model.PriceMultimedia).ToList(); } // TempData["listeMulti_Json"] = liste; var data = liste.Select(s => new DataJsonProductViewModel { Title = s.Title, Lat = s.Coordinate.Lat, Lon = s.Coordinate.Lon, id = s.id, Images = s.Images.Select(m => m.Image).FirstOrDefault(), Town = s.Town, Category = s.Category.CategoryName }).ToList(); //model.ListePro = new List<ProductModel>(); return(Json(data, JsonRequestBehavior.AllowGet)); }
// [OutputCache(Duration = 300, VaryByParam = "TownAllProduct;SearchTermAllProduct;pageNumber;sortBy")] public ActionResult SearchAllProoduct(SeachJobViewModel model, int?pageNumber, string sortBy) { ViewBag.PriceAscSort = String.IsNullOrEmpty(sortBy) ? "Price desc" : ""; ViewBag.PriceDescSort = sortBy == "Prix croissant" ? "Price asc" : ""; ViewBag.DateAscSort = sortBy == "Plus anciennes" ? "date asc" : ""; ViewBag.DateDescSort = sortBy == "Plus recentes" ? "date desc" : ""; //IQueryable<ProductModel> liste = dal.GetListProductWhithNoInclude(); List <ProductToDisplay> liste = dal.GetListProductToDisplay(); if (!string.IsNullOrWhiteSpace(model.Country)) { liste = liste.Where(m => m.Country != null && m.Country == model.Country).ToList(); } if (!string.IsNullOrWhiteSpace(model.TownAllProduct) && model.TownAllProduct != "Toutes les villes") { liste = liste.Where(m => m.Town != null && m.Town == model.TownAllProduct).ToList(); } if (!string.IsNullOrWhiteSpace(model.SearchTermAllProduct)) { liste = liste.Where(m => (m.Title != null && m.Title.ToLower().Contains(model.SearchTermAllProduct.ToLower())) || (m.Description != null && m.Description.ToLower().Contains(model.SearchTermAllProduct.ToLower())) || (m.Street != null && m.Street.ToLower().Contains(model.SearchTermAllProduct.ToLower())) || (m.SearchOrAskJob != null && m.SearchOrAskJob.ToLower().Contains(model.SearchTermAllProduct.ToLower()))).ToList(); } ViewBag.number = liste.Count(); switch (sortBy) { case "Price desc": liste = liste.OrderByDescending(m => m.Price).ToList(); break; case "Price asc": liste = liste.OrderBy(m => m.Price).ToList(); break; case "date desc": liste = liste.OrderByDescending(m => m.DateAdd).ToList(); break; case "date asc": liste = liste.OrderBy(m => m.DateAdd).ToList(); break; default: liste = liste.OrderByDescending(x => x.DateAdd).ToList(); break; } //model.ListeProduct = liste; //model.PageNumber = pageNumber; model.ListeProductPagedList = liste.ToPagedList(pageNumber ?? 1, 10); return(View("ListeAllProduct", model)); }
public async Task <JsonResult> ResultJobSpan_Jason(string sector, string town, string contract, int minPrice, int maxPrice, string country) { SeachJobViewModel model = new SeachJobViewModel(); model.ActivitySectorJob = sector; model.TownSearch = town; model.TypeContractJob = contract; model.PriceMinSearch = minPrice; model.PriceMaxSearch = maxPrice; model.Country = country; model.CagtegorieSearch = "Emploi"; model.SearchOrAskJobJob = "J'offre"; List <JobModel> liste = await dal.GetListJobWithNoInclude().Where(m => m.Category.CategoryName == model.CagtegorieSearch && m.SearchOrAskJob == model.SearchOrAskJobJob).ToListAsync(); if (!string.IsNullOrWhiteSpace(model.Country)) { liste = liste.Where(m => m.ProductCountry == model.Country).ToList(); } if (!string.IsNullOrWhiteSpace(model.TownSearch) && model.TownSearch != "Toutes les villes") { liste = liste.Where(m => m.Town == town).ToList(); } if (!string.IsNullOrWhiteSpace(model.TypeContractJob)) { liste = liste.Where(m => m.TypeContract != null && m.TypeContract == model.TypeContractJob).ToList(); } if (!string.IsNullOrWhiteSpace(model.ActivitySectorJob)) { liste = liste.Where(m => m.ActivitySector != null && m.ActivitySector == model.ActivitySectorJob).ToList(); } if (model.PriceMaxSearch >= 0 && model.PriceMinSearch >= 0 && model.PriceMaxSearch > model.PriceMinSearch) { liste = liste.Where(m => m.Price >= model.PriceMinSearch && m.Price <= model.PriceMaxSearch).ToList(); } else if (model.PriceMinSearch >= 0) { liste = liste.Where(m => m.Price >= model.PriceMinSearch).ToList(); } else if (model.PriceMaxSearch >= 0) { liste = liste.Where(m => m.Price <= model.PriceMaxSearch).ToList(); } var data = liste.Count(); return(Json(data, JsonRequestBehavior.AllowGet)); }
public async Task <JsonResult> searchOfferVehicule_Json(string town, string rubrique, string brand, string modele) { SeachJobViewModel model = new SeachJobViewModel(); model.TownVehicule = town; model.RubriqueVehicule = rubrique; model.BrandVehicule = brand; model.ModelVehicule = modele; model.CagtegorieSearch = "Vehicule"; model.SearchOrAskJobJob = "J'offre"; List <VehiculeModel> liste = await dal.GetListVehiculeWithNoInclude().Where(m => m.Category.CategoryName == model.CagtegorieSearch && m.SearchOrAskJob == model.SearchOrAskJobJob).ToListAsync(); if (!string.IsNullOrWhiteSpace(model.TownVehicule)) { liste = liste.Where(m => m.Town == model.TownVehicule).ToList(); } if (!string.IsNullOrWhiteSpace(model.RubriqueVehicule)) { liste = liste.Where(m => m.TypeVehicule == model.RubriqueVehicule).ToList(); } if (!string.IsNullOrWhiteSpace(model.BrandVehicule)) { liste = liste.Where(m => m.BrandVehicule == model.BrandVehicule).ToList(); } if (!string.IsNullOrWhiteSpace(model.ModelVehicule)) { liste = liste.Where(m => m.ModelVehicule == model.ModelVehicule).ToList(); } //TempData["listeVehicule_Json"] = liste; var data = liste.Select(s => new DataJsonProductViewModel { Title = s.Title, Lat = s.Coordinate.Lat, Lon = s.Coordinate.Lon, id = s.id, Images = s.Images.Select(m => m.Image).FirstOrDefault(), Town = s.Town, Category = s.Category.CategoryName }).ToList(); //model.ListePro = new List<ProductModel>(); return(Json(data, JsonRequestBehavior.AllowGet)); }
public async Task <JsonResult> ResultSearchOfferMultimediaSpan_Jason(string town, string type, string brand, string modele, string capacity, int maxPrice) { SeachJobViewModel model = new SeachJobViewModel(); model.TypeMultimedia = type; model.TownMultimedia = town; model.BrandMultimedia = brand; model.ModelMultimedia = modele; model.PriceMultimedia = maxPrice; model.Capacity = capacity; model.CagtegorieSearch = "Multimedia"; model.SearchOrAskJobJob = "J'offre"; List <MultimediaModel> liste = await dal.GetListMultimediaWithNoInclude().Where(m => m.Category.CategoryName == model.CagtegorieSearch && m.SearchOrAskJob == model.SearchOrAskJobJob).ToListAsync(); if (!string.IsNullOrWhiteSpace(model.TownMultimedia)) { liste = liste.Where(m => m.Town == model.TownMultimedia).ToList(); } if (!string.IsNullOrWhiteSpace(model.TypeMultimedia)) { liste = liste.Where(m => m.Type == model.TypeMultimedia).ToList(); } if (!string.IsNullOrWhiteSpace(model.BrandMultimedia)) { liste = liste.Where(m => m.Brand == model.BrandMultimedia).ToList(); } if (!string.IsNullOrWhiteSpace(model.ModelMultimedia)) { liste = liste.Where(m => m.Model == model.ModelMultimedia).ToList(); } if (!string.IsNullOrWhiteSpace(model.Capacity)) { liste = liste.Where(m => m.Capacity == model.Capacity).ToList(); } if (model.PriceMultimedia > 0) { liste = liste.Where(m => m.Price < model.PriceMultimedia).ToList(); } var data = liste.Count(); return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult listAllProductViewMapReturnJson(SeachJobViewModel model) { //List<ProductModel> liste = dal.GetListProductWhithNoInclude().ToList(); //if (!string.IsNullOrWhiteSpace(model.TownAllProduct)) //{ // liste = liste.Where(m => m.Town == model.TownAllProduct).ToList(); //} //if (!string.IsNullOrWhiteSpace(model.SearchTermAllProduct)) //{ // liste = liste.Where(m => m.Title != null && m.Title.ToLower().Contains(model.SearchTermAllProduct.ToLower()) // || m.Description != null && m.Description.ToLower().Contains(model.SearchTermAllProduct.ToLower()) || // m.Street.ToLower().Contains(model.SearchTermAllProduct.ToLower()) || // m.SearchOrAskJob.ToLower().Contains(model.SearchTermAllProduct.ToLower())).ToList(); // } return(View(model)); }
public async Task <ActionResult> UserProfile(int?ProductId, string message, int?pageNumber) { string id = User.Identity.GetUserId(); ApplicationUser user = dal.GetUserByStrId(id); if (user.Email.StartsWith("Mtest") && user.PhoneNumberConfirmed == false) { return(RedirectToAction("AddPhoneNumberFirstRegister", "Manage")); } if (!string.IsNullOrWhiteSpace(message)) { ViewBag.Succes = message; } if (ProductId != null) { var product = dal.GetListProductWhithNoInclude().FirstOrDefault(p => p.id == ProductId); if (product.Images.Count > 1) { var im = product.Images.FirstOrDefault(m => m.Image == "https://particulier-employeur.fr/wp-content/themes/fepem/img/general/avatar.png"); if (im != null) { await dal.DeleteImage(im); } } } List <ProductModel> liste = new List <ProductModel>(); if (User.IsInRole(MyRoleConstant.RoleAdmin) || (User.IsInRole(MyRoleConstant.Role_SuperAgent))) { liste = dal.GetListProductWhithNoInclude().Where(m => m.IsLookaukwat && m.IsActive).OrderByDescending(m => m.DateAdd).ToList(); } else { liste = dal.GetListProductWhithNoInclude().Where(m => m.User.Id == id && m.IsActive).OrderByDescending(m => m.DateAdd).ToList(); } SeachJobViewModel model = new SeachJobViewModel(); model.ListeProductUserPagedList = liste.ToPagedList(pageNumber ?? 1, 5); // ViewBag.UserId = id; return(View(model)); }
public async Task <JsonResult> searchOfferVehiculeSpan_Json(string town, string rubrique, string brand, string modele) { SeachJobViewModel model = new SeachJobViewModel(); model.TownVehicule = town; model.RubriqueVehicule = rubrique; model.BrandVehicule = brand; model.ModelVehicule = modele; model.CagtegorieSearch = "Vehicule"; model.SearchOrAskJobJob = "J'offre"; List <VehiculeModel> liste = await dal.GetListVehiculeWithNoInclude().Where(m => m.Category.CategoryName == model.CagtegorieSearch && m.SearchOrAskJob == model.SearchOrAskJobJob).ToListAsync(); if (!string.IsNullOrWhiteSpace(model.TownVehicule)) { liste = liste.Where(m => m.Town == model.TownVehicule).ToList(); } if (!string.IsNullOrWhiteSpace(model.RubriqueVehicule)) { liste = liste.Where(m => m.TypeVehicule == model.RubriqueVehicule).ToList(); } if (!string.IsNullOrWhiteSpace(model.BrandVehicule)) { liste = liste.Where(m => m.BrandVehicule == model.BrandVehicule).ToList(); } if (!string.IsNullOrWhiteSpace(model.ModelVehicule)) { liste = liste.Where(m => m.ModelVehicule == model.ModelVehicule).ToList(); } var data = liste.Count(); return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult ListeAllProduct(SeachJobViewModel model) { return(View(model)); }
public ActionResult SearchOfferHouse_PartialView(SeachJobViewModel model) { model.PriceHouse = 1000000000; return(PartialView(model)); }
public async Task <JsonResult> searchOfferHouseSpan_Json(string rubrique, string town, int maxPrice, string typeHouseAmmeublement, string typeHouseCuisine, string typeHouseDecoration, string typeHouseLinge, string fabricMaterialeHouseAmmeublementDeco, string fabricMaterialeHouseCuisine, string fabricMaterialeHouseLinge, string colorHouse, string stateHouse) { SeachJobViewModel model = new SeachJobViewModel(); model.TownHouse = town; model.RubriqueHouse = rubrique; model.PriceHouse = maxPrice; model.TypeHouseAmmeublement = typeHouseAmmeublement; model.TypeHouseCuisine = typeHouseCuisine; model.TypeHouseDecoration = typeHouseDecoration; model.TypeHouseLinge = typeHouseLinge; model.FabricMaterialeHouseAmmeublementDeco = fabricMaterialeHouseAmmeublementDeco; model.FabricMaterialeHouseCuisine = fabricMaterialeHouseCuisine; model.FabricMaterialeHouseLinge = fabricMaterialeHouseLinge; model.ColorHouse = colorHouse; model.StateHouse = stateHouse; model.ColorMode = colorHouse; model.CagtegorieSearch = "Maison"; model.SearchOrAskJobJob = "J'offre"; List <HouseModel> liste = await dal.GetListHouseWithNoInclude().Where(m => m.Category.CategoryName == model.CagtegorieSearch && m.SearchOrAskJob == model.SearchOrAskJobJob).ToListAsync(); if (!string.IsNullOrWhiteSpace(model.TownHouse)) { liste = liste.Where(m => m.Town == model.TownHouse).ToList(); } if (!string.IsNullOrWhiteSpace(model.ColorHouse)) { liste = liste.Where(m => m.ColorHouse == model.ColorHouse).ToList(); } if (!string.IsNullOrWhiteSpace(model.StateHouse)) { liste = liste.Where(m => m.StateHouse == model.StateHouse).ToList(); } if (model.PriceHouse > 0) { liste = liste.Where(m => m.Price < model.PriceHouse).ToList(); } switch (model.RubriqueHouse) { case "Ameublement": liste = liste.Where(m => m.RubriqueHouse == model.RubriqueHouse).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeHouseAmmeublement)) { liste = liste.Where(m => m.TypeHouse == model.TypeHouseAmmeublement).ToList(); } if (!string.IsNullOrWhiteSpace(model.FabricMaterialeHouseAmmeublementDeco)) { liste = liste.Where(m => m.FabricMaterialeHouse == model.FabricMaterialeHouseAmmeublementDeco).ToList(); } break; case "Cuisine": liste = liste.Where(m => m.RubriqueHouse == model.RubriqueHouse).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeHouseCuisine)) { liste = liste.Where(m => m.TypeHouse == model.TypeHouseCuisine).ToList(); } if (!string.IsNullOrWhiteSpace(model.FabricMaterialeHouseCuisine)) { liste = liste.Where(m => m.FabricMaterialeHouse == model.FabricMaterialeHouseCuisine).ToList(); } break; case "Décoration": liste = liste.Where(m => m.RubriqueHouse == model.RubriqueHouse).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeHouseDecoration)) { liste = liste.Where(m => m.TypeHouse == model.TypeHouseDecoration).ToList(); } if (!string.IsNullOrWhiteSpace(model.FabricMaterialeHouseAmmeublementDeco)) { liste = liste.Where(m => m.FabricMaterialeHouse == model.FabricMaterialeHouseAmmeublementDeco).ToList(); } break; case "Linge de maison": liste = liste.Where(m => m.RubriqueHouse == model.RubriqueHouse).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeHouseLinge)) { liste = liste.Where(m => m.TypeHouse == model.TypeHouseLinge).ToList(); } if (!string.IsNullOrWhiteSpace(model.FabricMaterialeHouseLinge)) { liste = liste.Where(m => m.FabricMaterialeHouse == model.FabricMaterialeHouseLinge).ToList(); } break; } var data = liste.Count(); return(Json(data, JsonRequestBehavior.AllowGet)); }
// [OutputCache(Duration = 300, VaryByParam = "TownSearch;Type;MaxApartSurface;MinApartSurface;PriceMaxSearch;PriceMinSearch;RoomNumber;FurnitureOrNot;pageNumber;sortBy")] public async Task <ActionResult> searchOfferAppart(SeachJobViewModel model, int?pageNumber, string sortBy) { ViewBag.PriceAscSort = String.IsNullOrEmpty(sortBy) ? "Price desc" : ""; ViewBag.PriceDescSort = sortBy == "Prix croissant" ? "Price asc" : ""; ViewBag.DateAscSort = sortBy == "Plus anciennes" ? "date asc" : ""; ViewBag.DateDescSort = sortBy == "Plus recentes" ? "date desc" : ""; model.CagtegorieSearch = "Immobilier"; model.SearchOrAskJobJob = "J'offre"; model.sortBy = sortBy; model.PageNumber = pageNumber; List <ApartmentRentalModel> liste = await dal.GetListAppartWithNoInclude().Where(m => m.Category.CategoryName == model.CagtegorieSearch && m.SearchOrAskJob == model.SearchOrAskJobJob).ToListAsync(); if (!string.IsNullOrWhiteSpace(model.TownSearch)) { liste = liste.Where(m => m.Town == model.TownSearch).ToList(); } if (!string.IsNullOrWhiteSpace(model.Type)) { liste = liste.Where(m => m.Type == model.Type).ToList(); } if (model.MaxApartSurface > 0 && model.MinApartSurface >= 0 && model.MaxApartSurface > model.MinApartSurface) { liste = liste.Where(m => m.ApartSurface <= model.MaxApartSurface && m.ApartSurface >= model.MinApartSurface).ToList(); } else if (model.MinApartSurface >= 0) { liste = liste.Where(m => m.ApartSurface >= model.MinApartSurface).ToList(); } else if (model.MaxApartSurface > 0) { liste = liste.Where(m => m.ApartSurface <= model.MaxApartSurface).ToList(); } if (model.PriceMaxSearch > 0 && model.PriceMinSearch >= 0 && model.PriceMinSearch > model.PriceMinSearch) { liste = liste.Where(m => m.Price <= model.PriceMaxSearch && m.Price >= model.PriceMinSearch).ToList(); } else if (model.PriceMinSearch >= 0) { liste = liste.Where(m => m.Price >= model.PriceMinSearch).ToList(); } else if (model.PriceMaxSearch > 0) { liste = liste.Where(m => m.Price <= model.PriceMaxSearch).ToList(); } if (model.Type != "Terrain à vendre") { if (model.RoomNumber > 0) { liste = liste.Where(m => m.RoomNumber == model.RoomNumber).ToList(); } if (model.FurnitureOrNot != null) { liste = liste.Where(m => m.FurnitureOrNot != model.FurnitureOrNot).ToList(); } } model.ListePro = new List <ProductModel>(); model.ListeProAppart = liste; switch (model.sortBy) { case "Price desc": model.ListeProAppart = model.ListeProAppart.OrderByDescending(m => m.Price).ToList(); model.ListeProPagedList = model.ListeProAppart.ToPagedList(model.PageNumber ?? 1, 10); break; case "Price asc": model.ListeProAppart = model.ListeProAppart.OrderBy(m => m.Price).ToList(); model.ListeProPagedList = model.ListeProAppart.ToPagedList(model.PageNumber ?? 1, 10); break; case "date desc": model.ListeProAppart = model.ListeProAppart.OrderByDescending(m => m.DateAdd).ToList(); model.ListeProPagedList = model.ListeProAppart.ToPagedList(model.PageNumber ?? 1, 10); break; case "date asc": model.ListeProAppart = model.ListeProAppart.OrderBy(m => m.DateAdd).ToList(); model.ListeProPagedList = model.ListeProAppart.ToPagedList(model.PageNumber ?? 1, 10); break; default: model.ListeProAppart = model.ListeProAppart.OrderByDescending(x => x.DateAdd).ToList(); model.ListeProPagedList = model.ListeProAppart.ToPagedList(model.PageNumber ?? 1, 10); break; } return(View("FilterSearchAppart", model)); // return RedirectToAction("ResultSearch_PartialView", "Product", model); }
//[OutputCache(Duration = 300, VaryByParam = "TownSearch;TypeContractJob;ActivitySectorJob;PriceMaxSearch;PriceMinSearch;pageNumber;sortBy")] public async Task <ActionResult> ResultSearchOfferJob_PartialView(SeachJobViewModel model, int?pageNumber, string sortBy) { ViewBag.PriceAscSort = String.IsNullOrEmpty(sortBy) ? "Price desc" : ""; ViewBag.PriceDescSort = sortBy == "Prix croissant" ? "Price asc" : ""; ViewBag.DateAscSort = sortBy == "Plus anciennes" ? "date asc" : ""; ViewBag.DateDescSort = sortBy == "Plus recentes" ? "date desc" : ""; model.CagtegorieSearch = "Emploi"; model.SearchOrAskJobJob = "J'offre"; model.sortBy = sortBy; model.PageNumber = pageNumber; List <JobModel> liste = await dal.GetListJobWithNoInclude().Where(m => m.Category.CategoryName == model.CagtegorieSearch && m.SearchOrAskJob == model.SearchOrAskJobJob).ToListAsync(); if (!string.IsNullOrWhiteSpace(model.Country)) { liste = liste.Where(m => m.ProductCountry == model.Country).ToList(); } if (!string.IsNullOrWhiteSpace(model.TownSearch) && model.TownSearch != "Toutes les villes") { liste = liste.Where(m => m.Town == model.TownSearch).ToList(); } if (!string.IsNullOrWhiteSpace(model.TypeContractJob)) { liste = liste.Where(m => m.TypeContract != null && m.TypeContract == model.TypeContractJob).ToList(); } if (!string.IsNullOrWhiteSpace(model.ActivitySectorJob)) { liste = liste.Where(m => m.ActivitySector != null && m.ActivitySector == model.ActivitySectorJob).ToList(); } if (model.PriceMaxSearch >= 0 && model.PriceMinSearch >= 0 && model.PriceMaxSearch > model.PriceMinSearch) { liste = liste.Where(m => m.Price >= model.PriceMinSearch && m.Price <= model.PriceMaxSearch).ToList(); } else if (model.PriceMinSearch >= 0) { liste = liste.Where(m => m.Price >= model.PriceMinSearch).ToList(); } else if (model.PriceMaxSearch >= 0) { liste = liste.Where(m => m.Price <= model.PriceMaxSearch).ToList(); } model.ListePro = new List <ProductModel>(); model.ListeProJob = liste; switch (model.sortBy) { case "Price desc": model.ListeProJob = model.ListeProJob.OrderByDescending(m => m.Price).ToList(); model.ListeProPagedList = model.ListePro.ToPagedList(model.PageNumber ?? 1, 10); break; case "Price asc": model.ListeProJob = model.ListeProJob.OrderBy(m => m.Price).ToList(); model.ListeProPagedList = model.ListePro.ToPagedList(model.PageNumber ?? 1, 10); break; case "date desc": model.ListeProJob = model.ListeProJob.OrderByDescending(m => m.DateAdd).ToList(); model.ListeProPagedList = model.ListePro.ToPagedList(model.PageNumber ?? 1, 10); break; case "date asc": model.ListeProJob = model.ListeProJob.OrderBy(m => m.DateAdd).ToList(); model.ListeProPagedList = model.ListePro.ToPagedList(model.PageNumber ?? 1, 10); break; default: model.ListeProJob = model.ListeProJob.OrderByDescending(x => x.DateAdd).ToList(); model.ListeProPagedList = model.ListeProJob.ToPagedList(model.PageNumber ?? 1, 10); break; } foreach (var mode in model.ListeProPagedList) { if (mode.Images.Count > 1) { mode.Images = mode.Images.Where(m => !m.Image.StartsWith("http")).ToList(); } } return(View("FilterSearchJob", model)); }
public async Task <JsonResult> ResultSearchOfferJob_Jason(string sector, string town, string contract, int minPrice, int maxPrice, string country) { SeachJobViewModel model = new SeachJobViewModel(); model.ActivitySectorJob = sector; model.TownSearch = town; model.TypeContractJob = contract; model.PriceMinSearch = minPrice; model.PriceMaxSearch = maxPrice; model.Country = country; model.CagtegorieSearch = "Emploi"; model.SearchOrAskJobJob = "J'offre"; List <JobModel> liste = await dal.GetListJobWithNoInclude().Where(m => m.Category.CategoryName == model.CagtegorieSearch && m.SearchOrAskJob == model.SearchOrAskJobJob).ToListAsync(); if (!string.IsNullOrWhiteSpace(model.Country)) { liste = liste.Where(m => m.ProductCountry == model.Country).ToList(); } if (!string.IsNullOrWhiteSpace(model.TownSearch) && model.TownSearch != "Toutes les villes") { liste = liste.Where(m => m.Town == town).ToList(); } if (!string.IsNullOrWhiteSpace(model.TypeContractJob)) { liste = liste.Where(m => m.TypeContract != null && m.TypeContract == model.TypeContractJob).ToList(); } if (!string.IsNullOrWhiteSpace(model.ActivitySectorJob)) { liste = liste.Where(m => m.ActivitySector != null && m.ActivitySector == model.ActivitySectorJob).ToList(); } if (model.PriceMaxSearch >= 0 && model.PriceMinSearch >= 0 && model.PriceMaxSearch > model.PriceMinSearch) { liste = liste.Where(m => m.Price >= model.PriceMinSearch && m.Price <= model.PriceMaxSearch).ToList(); } else if (model.PriceMinSearch >= 0) { liste = liste.Where(m => m.Price >= model.PriceMinSearch).ToList(); } else if (model.PriceMaxSearch >= 0) { liste = liste.Where(m => m.Price <= model.PriceMaxSearch).ToList(); } // TempData["listeJobJson"] = liste; var data = liste.Select(s => new DataJsonProductViewModel { Title = s.Title, Lat = s.Coordinate.Lat, Lon = s.Coordinate.Lon, id = s.id, Images = s.Images.Select(m => m.Image).FirstOrDefault(), Town = s.Town, Category = s.Category.CategoryName }).ToList(); //model.ListePro = new List<ProductModel>(); return(Json(data, JsonRequestBehavior.AllowGet)); }
public async Task <JsonResult> ResultSearchOfferApartSpan_Jason(string type, string town, int minSurface, int maxSurface, string furnitureOrNot, int roomNumber, int minPrice, int maxPrice) { SeachJobViewModel model = new SeachJobViewModel(); model.Type = type; model.TownSearch = town; model.MinApartSurface = minSurface; model.MaxApartSurface = maxSurface; model.PriceMinSearch = minPrice; model.PriceMaxSearch = maxPrice; model.FurnitureOrNot = furnitureOrNot; model.RoomNumber = roomNumber; model.CagtegorieSearch = "Immobilier"; model.SearchOrAskJobJob = "J'offre"; List <ApartmentRentalModel> liste = await dal.GetListAppartWithNoInclude().Where(m => m.Category.CategoryName == model.CagtegorieSearch && m.SearchOrAskJob == model.SearchOrAskJobJob).ToListAsync(); if (!string.IsNullOrWhiteSpace(model.TownSearch)) { liste = liste.Where(m => m.Town == model.TownSearch).ToList(); } if (!string.IsNullOrWhiteSpace(model.Type)) { liste = liste.Where(m => m.Type == model.Type).ToList(); } if (model.MaxApartSurface > 0 && model.MinApartSurface >= 0 && model.MaxApartSurface > model.MinApartSurface) { liste = liste.Where(m => m.ApartSurface <= model.MaxApartSurface && m.ApartSurface >= model.MinApartSurface).ToList(); } else if (model.MinApartSurface >= 0) { liste = liste.Where(m => m.ApartSurface >= model.MinApartSurface).ToList(); } else if (model.MaxApartSurface > 0) { liste = liste.Where(m => m.ApartSurface <= model.MaxApartSurface).ToList(); } if (model.PriceMaxSearch > 0 && model.PriceMinSearch >= 0 && model.PriceMinSearch > model.PriceMinSearch) { liste = liste.Where(m => m.Price <= model.PriceMaxSearch && m.Price >= model.PriceMinSearch).ToList(); } else if (model.PriceMinSearch >= 0) { liste = liste.Where(m => m.Price >= model.PriceMinSearch).ToList(); } else if (model.PriceMaxSearch > 0) { liste = liste.Where(m => m.Price <= model.PriceMaxSearch).ToList(); } if (model.Type != "Terrain à vendre") { if (model.RoomNumber > 0) { liste = liste.Where(m => m.RoomNumber == model.RoomNumber).ToList(); } if (model.FurnitureOrNot != null) { liste = liste.Where(m => m.FurnitureOrNot != model.FurnitureOrNot).ToList(); } } var data = liste.Count(); return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult SearchOfferAppart_PartialView(SeachJobViewModel model) { return(PartialView(model)); }
public ActionResult FilterSearchMultimedia(SeachJobViewModel model) { return(View(model)); }
public async Task <JsonResult> searchOfferHouse_Json(string rubrique, string town, int maxPrice, string typeHouseAmmeublement, string typeHouseCuisine, string typeHouseDecoration, string typeHouseLinge, string fabricMaterialeHouseAmmeublementDeco, string fabricMaterialeHouseCuisine, string fabricMaterialeHouseLinge, string colorHouse, string stateHouse) { SeachJobViewModel model = new SeachJobViewModel(); model.TownHouse = town; model.RubriqueHouse = rubrique; model.PriceHouse = maxPrice; model.TypeHouseAmmeublement = typeHouseAmmeublement; model.TypeHouseCuisine = typeHouseCuisine; model.TypeHouseDecoration = typeHouseDecoration; model.TypeHouseLinge = typeHouseLinge; model.FabricMaterialeHouseAmmeublementDeco = fabricMaterialeHouseAmmeublementDeco; model.FabricMaterialeHouseCuisine = fabricMaterialeHouseCuisine; model.FabricMaterialeHouseLinge = fabricMaterialeHouseLinge; model.ColorHouse = colorHouse; model.StateHouse = stateHouse; model.ColorMode = colorHouse; model.CagtegorieSearch = "Maison"; model.SearchOrAskJobJob = "J'offre"; List <HouseModel> liste = await dal.GetListHouseWithNoInclude().Where(m => m.Category.CategoryName == model.CagtegorieSearch && m.SearchOrAskJob == model.SearchOrAskJobJob).ToListAsync(); if (!string.IsNullOrWhiteSpace(model.TownHouse)) { liste = liste.Where(m => m.Town == model.TownHouse).ToList(); } if (!string.IsNullOrWhiteSpace(model.ColorHouse)) { liste = liste.Where(m => m.ColorHouse == model.ColorHouse).ToList(); } if (!string.IsNullOrWhiteSpace(model.StateHouse)) { liste = liste.Where(m => m.StateHouse == model.StateHouse).ToList(); } if (model.PriceHouse > 0) { liste = liste.Where(m => m.Price < model.PriceHouse).ToList(); } switch (model.RubriqueHouse) { case "Ameublement": liste = liste.Where(m => m.RubriqueHouse == model.RubriqueHouse).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeHouseAmmeublement)) { liste = liste.Where(m => m.TypeHouse == model.TypeHouseAmmeublement).ToList(); } if (!string.IsNullOrWhiteSpace(model.FabricMaterialeHouseAmmeublementDeco)) { liste = liste.Where(m => m.FabricMaterialeHouse == model.FabricMaterialeHouseAmmeublementDeco).ToList(); } break; case "Cuisine": liste = liste.Where(m => m.RubriqueHouse == model.RubriqueHouse).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeHouseCuisine)) { liste = liste.Where(m => m.TypeHouse == model.TypeHouseCuisine).ToList(); } if (!string.IsNullOrWhiteSpace(model.FabricMaterialeHouseCuisine)) { liste = liste.Where(m => m.FabricMaterialeHouse == model.FabricMaterialeHouseCuisine).ToList(); } break; case "Décoration": liste = liste.Where(m => m.RubriqueHouse == model.RubriqueHouse).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeHouseDecoration)) { liste = liste.Where(m => m.TypeHouse == model.TypeHouseDecoration).ToList(); } if (!string.IsNullOrWhiteSpace(model.FabricMaterialeHouseAmmeublementDeco)) { liste = liste.Where(m => m.FabricMaterialeHouse == model.FabricMaterialeHouseAmmeublementDeco).ToList(); } break; case "Linge de maison": liste = liste.Where(m => m.RubriqueHouse == model.RubriqueHouse).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeHouseLinge)) { liste = liste.Where(m => m.TypeHouse == model.TypeHouseLinge).ToList(); } if (!string.IsNullOrWhiteSpace(model.FabricMaterialeHouseLinge)) { liste = liste.Where(m => m.FabricMaterialeHouse == model.FabricMaterialeHouseLinge).ToList(); } break; } // TempData["listeHouse_json"] = liste; var data = liste.Select(s => new DataJsonProductViewModel { Title = s.Title, Lat = s.Coordinate.Lat, Lon = s.Coordinate.Lon, id = s.id, Images = s.Images.Select(m => m.Image).FirstOrDefault(), Town = s.Town, Category = s.Category.CategoryName }).ToList(); //model.ListePro = new List<ProductModel>(); return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult SearchOfferMultimedia_PartialView(SeachJobViewModel model) { model.PriceMultimedia = 1000000000; return(PartialView(model)); }
public ActionResult FilterSearchHouse(SeachJobViewModel model) { return(View(model)); }
//[OutputCache(Duration = 300, VaryByParam = "TownMultimedia;TypeMultimedia;BrandMultimedia;ModelMultimedia;Capacity;PriceMultimedia;pageNumber;sortBy")] public async Task <ActionResult> searchOfferMultimedia(SeachJobViewModel model, int?pageNumber, string sortBy) { ViewBag.PriceAscSort = String.IsNullOrEmpty(sortBy) ? "Price desc" : ""; ViewBag.PriceDescSort = sortBy == "Prix croissant" ? "Price asc" : ""; ViewBag.DateAscSort = sortBy == "Plus anciennes" ? "date asc" : ""; ViewBag.DateDescSort = sortBy == "Plus recentes" ? "date desc" : ""; model.CagtegorieSearch = "Multimedia"; model.SearchOrAskJobJob = "J'offre"; model.sortBy = sortBy; model.PageNumber = pageNumber; List <MultimediaModel> liste = await dal.GetListMultimediaWithNoInclude().Where(m => m.Category.CategoryName == model.CagtegorieSearch && m.SearchOrAskJob == model.SearchOrAskJobJob).ToListAsync(); if (!string.IsNullOrWhiteSpace(model.TownMultimedia)) { liste = liste.Where(m => m.Town == model.TownMultimedia).ToList(); } if (!string.IsNullOrWhiteSpace(model.TypeMultimedia)) { liste = liste.Where(m => m.Type == model.TypeMultimedia).ToList(); } if (!string.IsNullOrWhiteSpace(model.BrandMultimedia)) { liste = liste.Where(m => m.Brand == model.BrandMultimedia).ToList(); } if (!string.IsNullOrWhiteSpace(model.ModelMultimedia)) { liste = liste.Where(m => m.Model == model.ModelMultimedia).ToList(); } if (!string.IsNullOrWhiteSpace(model.Capacity)) { liste = liste.Where(m => m.Capacity == model.Capacity).ToList(); } if (model.PriceMultimedia > 0) { liste = liste.Where(m => m.Price < model.PriceMultimedia).ToList(); } model.ListePro = new List <ProductModel>(); model.ListeProMulti = liste; switch (model.sortBy) { case "Price desc": model.ListeProMulti = model.ListeProMulti.OrderByDescending(m => m.Price).ToList(); model.ListeProPagedList = model.ListeProMulti.ToPagedList(model.PageNumber ?? 1, 10); break; case "Price asc": model.ListeProMulti = model.ListeProMulti.OrderBy(m => m.Price).ToList(); model.ListeProPagedList = model.ListeProMulti.ToPagedList(model.PageNumber ?? 1, 10); break; case "date desc": model.ListeProMulti = model.ListeProMulti.OrderByDescending(m => m.DateAdd).ToList(); model.ListeProPagedList = model.ListeProMulti.ToPagedList(model.PageNumber ?? 1, 10); break; case "date asc": model.ListeProMulti = model.ListeProMulti.OrderBy(m => m.DateAdd).ToList(); model.ListeProPagedList = model.ListeProMulti.ToPagedList(model.PageNumber ?? 1, 10); break; default: model.ListeProMulti = model.ListeProMulti.OrderByDescending(x => x.DateAdd).ToList(); model.ListeProPagedList = model.ListeProMulti.ToPagedList(model.PageNumber ?? 1, 10); break; } return(View("FilterSearchMultimedia", model)); // return RedirectToAction("ResultSearch_PartialView", "Product", model); }
// [OutputCache(Duration = 300, VaryByParam = "TownHouse;ColorHouse;StateHouse;PriceHouse;RubriqueHouse;pageNumber;sortBy")] public ActionResult searchOfferHouse(SeachJobViewModel model, int?pageNumber, string sortBy) { ViewBag.PriceAscSort = String.IsNullOrEmpty(sortBy) ? "Price desc" : ""; ViewBag.PriceDescSort = sortBy == "Prix croissant" ? "Price asc" : ""; ViewBag.DateAscSort = sortBy == "Plus anciennes" ? "date asc" : ""; ViewBag.DateDescSort = sortBy == "Plus recentes" ? "date desc" : ""; model.CagtegorieSearch = "Maison"; model.SearchOrAskJobJob = "J'offre"; model.sortBy = sortBy; model.PageNumber = pageNumber; List <HouseModel> liste = dal.GetListHouseWithNoInclude().Where(m => m.Category.CategoryName == model.CagtegorieSearch && m.SearchOrAskJob == model.SearchOrAskJobJob).ToList(); if (!string.IsNullOrWhiteSpace(model.TownHouse)) { liste = liste.Where(m => m.Town == model.TownHouse).ToList(); } if (!string.IsNullOrWhiteSpace(model.ColorHouse)) { liste = liste.Where(m => m.ColorHouse == model.ColorHouse).ToList(); } if (!string.IsNullOrWhiteSpace(model.StateHouse)) { liste = liste.Where(m => m.StateHouse == model.StateHouse).ToList(); } if (model.PriceHouse > 0) { liste = liste.Where(m => m.Price < model.PriceHouse).ToList(); } switch (model.RubriqueHouse) { case "Ameublement": liste = liste.Where(m => m.RubriqueHouse == model.RubriqueHouse).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeHouseAmmeublement)) { liste = liste.Where(m => m.TypeHouse == model.TypeHouseAmmeublement).ToList(); } if (!string.IsNullOrWhiteSpace(model.FabricMaterialeHouseAmmeublementDeco)) { liste = liste.Where(m => m.FabricMaterialeHouse == model.FabricMaterialeHouseAmmeublementDeco).ToList(); } break; case "Cuisine": liste = liste.Where(m => m.RubriqueHouse == model.RubriqueHouse).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeHouseCuisine)) { liste = liste.Where(m => m.TypeHouse == model.TypeHouseCuisine).ToList(); } if (!string.IsNullOrWhiteSpace(model.FabricMaterialeHouseCuisine)) { liste = liste.Where(m => m.FabricMaterialeHouse == model.FabricMaterialeHouseCuisine).ToList(); } break; case "Décoration": liste = liste.Where(m => m.RubriqueHouse == model.RubriqueHouse).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeHouseDecoration)) { liste = liste.Where(m => m.TypeHouse == model.TypeHouseDecoration).ToList(); } if (!string.IsNullOrWhiteSpace(model.FabricMaterialeHouseAmmeublementDeco)) { liste = liste.Where(m => m.FabricMaterialeHouse == model.FabricMaterialeHouseAmmeublementDeco).ToList(); } break; case "Linge de maison": liste = liste.Where(m => m.RubriqueHouse == model.RubriqueHouse).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeHouseLinge)) { liste = liste.Where(m => m.TypeHouse == model.TypeHouseLinge).ToList(); } if (!string.IsNullOrWhiteSpace(model.FabricMaterialeHouseLinge)) { liste = liste.Where(m => m.FabricMaterialeHouse == model.FabricMaterialeHouseLinge).ToList(); } break; } model.ListePro = new List <ProductModel>(); model.ListeProHouse = liste; switch (model.sortBy) { case "Price desc": model.ListeProHouse = model.ListeProHouse.OrderByDescending(m => m.Price).ToList(); model.ListeProPagedList = model.ListeProHouse.ToPagedList(model.PageNumber ?? 1, 10); break; case "Price asc": model.ListeProHouse = model.ListeProHouse.OrderBy(m => m.Price).ToList(); model.ListeProPagedList = model.ListeProHouse.ToPagedList(model.PageNumber ?? 1, 10); break; case "date desc": model.ListeProHouse = model.ListeProHouse.OrderByDescending(m => m.DateAdd).ToList(); model.ListeProPagedList = model.ListeProHouse.ToPagedList(model.PageNumber ?? 1, 10); break; case "date asc": model.ListeProHouse = model.ListeProHouse.OrderBy(m => m.DateAdd).ToList(); model.ListeProPagedList = model.ListeProHouse.ToPagedList(model.PageNumber ?? 1, 10); break; default: model.ListeProHouse = model.ListeProHouse.OrderByDescending(x => x.DateAdd).ToList(); model.ListeProPagedList = model.ListeProHouse.ToPagedList(model.PageNumber ?? 1, 10); break; } return(View("FilterSearchHouse", model)); // return RedirectToAction("ResultSearch_PartialView", "Product", model); }
public async Task <JsonResult> searchOfferMode_Json(string rubrique, string town, string typeClothes, string typeShoes, string typeLuggages, string typeWatch, string typeBabyEquipment, string typeBabyClothes, string brandClothes, string brandShoes, int price, string state, string color, string univers, string sizeSchoes, string sizeClothes) { SeachJobViewModel model = new SeachJobViewModel(); model.TownMode = town; model.RubriqueMode = rubrique; model.TypeModeClothes = typeClothes; model.TypeModeShoes = typeShoes; model.TypeModeAccesorieLugages = typeLuggages; model.TypeModeWatchJewelry = typeWatch; model.TypeModeBabyEquipment = typeBabyEquipment; model.TypeModeBabyClothes = typeBabyClothes; model.BrandModeClothes = brandClothes; model.BrandModeShoes = brandShoes; model.PriceMode = price; model.StateMode = state; model.ColorMode = color; model.UniversMode = univers; model.SizeModeClothes = sizeClothes; model.SizeModeShoes = sizeSchoes; model.CagtegorieSearch = "Mode"; model.SearchOrAskJobJob = "J'offre"; List <ModeModel> liste = await dal.GetListModeWithNoInclude().Where(m => m.Category.CategoryName == model.CagtegorieSearch && m.SearchOrAskJob == model.SearchOrAskJobJob).ToListAsync(); if (!string.IsNullOrWhiteSpace(model.TownMode)) { liste = liste.Where(m => m.Town == model.TownMode).ToList(); } if (!string.IsNullOrWhiteSpace(model.ColorMode)) { liste = liste.Where(m => m.ColorMode == model.ColorMode).ToList(); } if (!string.IsNullOrWhiteSpace(model.StateMode)) { liste = liste.Where(m => m.StateMode == model.StateMode).ToList(); } if (model.PriceMode > 0) { liste = liste.Where(m => m.Price < model.PriceMode).ToList(); } switch (model.RubriqueMode) { case "Vêtements": liste = liste.Where(m => m.RubriqueMode == model.RubriqueMode).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeModeClothes)) { liste = liste.Where(m => m.TypeMode == model.TypeModeClothes).ToList(); } if (!string.IsNullOrWhiteSpace(model.BrandModeClothes)) { liste = liste.Where(m => m.BrandMode == model.BrandModeClothes).ToList(); } if (!string.IsNullOrWhiteSpace(model.SizeModeClothes)) { liste = liste.Where(m => m.SizeMode == model.SizeModeClothes).ToList(); } break; case "Chaussures": liste = liste.Where(m => m.RubriqueMode == model.RubriqueMode).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeModeShoes)) { liste = liste.Where(m => m.TypeMode == model.TypeModeShoes).ToList(); } if (!string.IsNullOrWhiteSpace(model.BrandModeShoes)) { liste = liste.Where(m => m.BrandMode == model.BrandModeShoes).ToList(); } if (!string.IsNullOrWhiteSpace(model.SizeModeShoes)) { liste = liste.Where(m => m.SizeMode == model.SizeModeShoes).ToList(); } break; case "Accesoires & Bagagerie": liste = liste.Where(m => m.RubriqueMode == model.RubriqueMode).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeModeAccesorieLugages)) { liste = liste.Where(m => m.TypeMode == model.TypeModeAccesorieLugages).ToList(); } if (!string.IsNullOrWhiteSpace(model.BrandModeClothes)) { liste = liste.Where(m => m.BrandMode == model.BrandModeClothes).ToList(); } break; case "Montres & Bijoux": liste = liste.Where(m => m.RubriqueMode == model.RubriqueMode).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeModeWatchJewelry)) { liste = liste.Where(m => m.TypeMode == model.TypeModeWatchJewelry).ToList(); } if (!string.IsNullOrWhiteSpace(model.BrandModeClothes)) { liste = liste.Where(m => m.BrandMode == model.BrandModeClothes).ToList(); } break; case "Equipement bébé": liste = liste.Where(m => m.RubriqueMode == model.RubriqueMode).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeModeBabyEquipment)) { liste = liste.Where(m => m.TypeMode == model.TypeModeBabyEquipment).ToList(); } if (!string.IsNullOrWhiteSpace(model.BrandModeClothes)) { liste = liste.Where(m => m.BrandMode == model.BrandModeClothes).ToList(); } break; case "Vêtements bébé": liste = liste.Where(m => m.RubriqueMode == model.RubriqueMode).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeModeBabyClothes)) { liste = liste.Where(m => m.TypeMode == model.TypeModeBabyClothes).ToList(); } if (!string.IsNullOrWhiteSpace(model.BrandModeClothes)) { liste = liste.Where(m => m.BrandMode == model.BrandModeClothes).ToList(); } if (!string.IsNullOrWhiteSpace(model.SizeModeClothes)) { liste = liste.Where(m => m.SizeMode == model.SizeModeClothes).ToList(); } break; } // TempData["listeMode_json"] = liste; var data = liste.Select(s => new DataJsonProductViewModel { Title = s.Title, Lat = s.Coordinate.Lat, Lon = s.Coordinate.Lon, id = s.id, Images = s.Images.Select(m => m.Image).FirstOrDefault(), Town = s.Town, Category = s.Category.CategoryName }).ToList(); //model.ListePro = new List<ProductModel>(); return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult SearchAllProductMapView_PartialView(SeachJobViewModel model) { return(PartialView(model)); }
public async Task <JsonResult> searchOfferModeSpan_Json(string rubrique, string town, string typeClothes, string typeShoes, string typeLuggages, string typeWatch, string typeBabyEquipment, string typeBabyClothes, string brandClothes, string brandShoes, int price, string state, string color, string univers, string sizeSchoes, string sizeClothes) { SeachJobViewModel model = new SeachJobViewModel(); model.TownMode = town; model.RubriqueMode = rubrique; model.TypeModeClothes = typeClothes; model.TypeModeShoes = typeShoes; model.TypeModeAccesorieLugages = typeLuggages; model.TypeModeWatchJewelry = typeWatch; model.TypeModeBabyEquipment = typeBabyEquipment; model.TypeModeBabyClothes = typeBabyClothes; model.BrandModeClothes = brandClothes; model.BrandModeShoes = brandShoes; model.PriceMode = price; model.StateMode = state; model.ColorMode = color; model.UniversMode = univers; model.SizeModeClothes = sizeClothes; model.SizeModeShoes = sizeSchoes; model.CagtegorieSearch = "Mode"; model.SearchOrAskJobJob = "J'offre"; List <ModeModel> liste = await dal.GetListModeWithNoInclude().Where(m => m.Category.CategoryName == model.CagtegorieSearch && m.SearchOrAskJob == model.SearchOrAskJobJob).ToListAsync(); if (!string.IsNullOrWhiteSpace(model.TownMode)) { liste = liste.Where(m => m.Town == model.TownMode).ToList(); } if (!string.IsNullOrWhiteSpace(model.ColorMode)) { liste = liste.Where(m => m.ColorMode == model.ColorMode).ToList(); } if (!string.IsNullOrWhiteSpace(model.StateMode)) { liste = liste.Where(m => m.StateMode == model.StateMode).ToList(); } if (model.PriceMode > 0) { liste = liste.Where(m => m.Price < model.PriceMode).ToList(); } switch (model.RubriqueMode) { case "Vêtements": liste = liste.Where(m => m.RubriqueMode == model.RubriqueMode).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeModeClothes)) { liste = liste.Where(m => m.TypeMode == model.TypeModeClothes).ToList(); } if (!string.IsNullOrWhiteSpace(model.BrandModeClothes)) { liste = liste.Where(m => m.BrandMode == model.BrandModeClothes).ToList(); } if (!string.IsNullOrWhiteSpace(model.SizeModeClothes)) { liste = liste.Where(m => m.SizeMode == model.SizeModeClothes).ToList(); } break; case "Chaussures": liste = liste.Where(m => m.RubriqueMode == model.RubriqueMode).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeModeShoes)) { liste = liste.Where(m => m.TypeMode == model.TypeModeShoes).ToList(); } if (!string.IsNullOrWhiteSpace(model.BrandModeShoes)) { liste = liste.Where(m => m.BrandMode == model.BrandModeShoes).ToList(); } if (!string.IsNullOrWhiteSpace(model.SizeModeShoes)) { liste = liste.Where(m => m.SizeMode == model.SizeModeShoes).ToList(); } break; case "Accesoires & Bagagerie": liste = liste.Where(m => m.RubriqueMode == model.RubriqueMode).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeModeAccesorieLugages)) { liste = liste.Where(m => m.TypeMode == model.TypeModeAccesorieLugages).ToList(); } if (!string.IsNullOrWhiteSpace(model.BrandModeClothes)) { liste = liste.Where(m => m.BrandMode == model.BrandModeClothes).ToList(); } break; case "Montres & Bijoux": liste = liste.Where(m => m.RubriqueMode == model.RubriqueMode).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeModeWatchJewelry)) { liste = liste.Where(m => m.TypeMode == model.TypeModeWatchJewelry).ToList(); } if (!string.IsNullOrWhiteSpace(model.BrandModeClothes)) { liste = liste.Where(m => m.BrandMode == model.BrandModeClothes).ToList(); } break; case "Equipement bébé": liste = liste.Where(m => m.RubriqueMode == model.RubriqueMode).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeModeBabyEquipment)) { liste = liste.Where(m => m.TypeMode == model.TypeModeBabyEquipment).ToList(); } if (!string.IsNullOrWhiteSpace(model.BrandModeClothes)) { liste = liste.Where(m => m.BrandMode == model.BrandModeClothes).ToList(); } break; case "Vêtements bébé": liste = liste.Where(m => m.RubriqueMode == model.RubriqueMode).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeModeBabyClothes)) { liste = liste.Where(m => m.TypeMode == model.TypeModeBabyClothes).ToList(); } if (!string.IsNullOrWhiteSpace(model.BrandModeClothes)) { liste = liste.Where(m => m.BrandMode == model.BrandModeClothes).ToList(); } if (!string.IsNullOrWhiteSpace(model.SizeModeClothes)) { liste = liste.Where(m => m.SizeMode == model.SizeModeClothes).ToList(); } break; } var data = liste.Count(); return(Json(data, JsonRequestBehavior.AllowGet)); }
//result of every search product public ActionResult ResultSearch_PartialView(SeachJobViewModel modelresult, int?pageNumber, string sortBy, AskJobViewModel model) { if (modelresult.CagtegorieSearch != null) { switch (modelresult.CagtegorieSearch) { case "Emploi": try { var result = TempData["listeJob"] as List <JobModel>; if (result != null) { foreach (var element in result) { modelresult.ListePro.Add(element); } } } catch (Exception e) { Console.WriteLine(e.ToString()); } break; case "Immobilier": try { var resultImmobilier = TempData["listeApart"] as List <ApartmentRentalModel>; if (resultImmobilier != null) { foreach (var element in resultImmobilier) { modelresult.ListePro.Add(element); } } } catch (Exception e) { Console.WriteLine(e.ToString()); } break; case "Multimedia": try { var resultMultimedia = TempData["listeMulti"] as List <MultimediaModel>; if (resultMultimedia != null) { foreach (var element in resultMultimedia) { modelresult.ListePro.Add(element); } } } catch (Exception e) { Console.WriteLine(e.ToString()); } break; case "Vehicule": try { var resultVehicule = TempData["listeVehicule"] as List <VehiculeModel>; if (resultVehicule != null) { foreach (var element in resultVehicule) { modelresult.ListePro.Add(element); } } } catch (Exception e) { Console.WriteLine(e.ToString()); } break; case "Mode": try { var resultMode = TempData["listeMode"] as List <ModeModel>; if (resultMode != null) { foreach (var element in resultMode) { modelresult.ListePro.Add(element); } } } catch (Exception e) { Console.WriteLine(e.ToString()); } break; } if (modelresult.ListePro == null) { modelresult.ListePro = new List <ProductModel>(); } switch (sortBy) { case "Price desc": modelresult.ListePro = modelresult.ListePro.OrderByDescending(m => m.Price).ToList(); modelresult.ListeProPagedList = modelresult.ListePro.ToPagedList(pageNumber ?? 1, 10); break; case "Price asc": modelresult.ListePro = modelresult.ListePro.OrderBy(m => m.Price).ToList(); modelresult.ListeProPagedList = modelresult.ListePro.ToPagedList(pageNumber ?? 1, 10); break; case "date desc": modelresult.ListePro = modelresult.ListePro.OrderByDescending(m => m.DateAdd).ToList(); modelresult.ListeProPagedList = modelresult.ListePro.ToPagedList(pageNumber ?? 1, 10); break; case "date asc": modelresult.ListePro = modelresult.ListePro.OrderBy(m => m.DateAdd).ToList(); modelresult.ListeProPagedList = modelresult.ListePro.ToPagedList(pageNumber ?? 1, 10); break; default: modelresult.ListePro = modelresult.ListePro.OrderByDescending(x => x.DateAdd).ToList(); modelresult.ListeProPagedList = modelresult.ListePro.ToPagedList(pageNumber ?? 1, 10); break; } return(PartialView(modelresult)); } else { modelresult = new SeachJobViewModel(); modelresult.ListePro = new List <ProductModel>(); modelresult.CagtegorieSearch = "AskSearch"; try { var result = TempData["listeSearchAsk"] as List <ProductModel>; if (result != null) { foreach (var element in result) { modelresult.ListePro.Add(element); } } } catch (Exception e) { Console.WriteLine(e.ToString()); } switch (sortBy) { case "Price desc": modelresult.ListePro = modelresult.ListePro.OrderByDescending(m => m.Price).ToList(); modelresult.ListeProPagedList = modelresult.ListePro.ToPagedList(pageNumber ?? 1, 10); break; case "Price asc": modelresult.ListePro = modelresult.ListePro.OrderBy(m => m.Price).ToList(); modelresult.ListeProPagedList = modelresult.ListePro.ToPagedList(pageNumber ?? 1, 10); break; case "date desc": modelresult.ListePro = modelresult.ListePro.OrderByDescending(m => m.id).ToList(); modelresult.ListeProPagedList = modelresult.ListePro.ToPagedList(pageNumber ?? 1, 10); break; case "date asc": modelresult.ListePro = modelresult.ListePro.OrderBy(m => m.id).ToList(); modelresult.ListeProPagedList = modelresult.ListePro.ToPagedList(pageNumber ?? 1, 10); break; default: modelresult.ListePro = modelresult.ListePro.OrderByDescending(x => x.id).ToList(); modelresult.ListeProPagedList = modelresult.ListePro.ToPagedList(pageNumber ?? 1, 10); break; } return(PartialView(modelresult)); } // modelresult.ListePro = TempData["listeJob"] as List<ProductModel>; // modelresult.ListePro = dal.GetListProduct().Where(r => r.Title.IndexOf(modelresult.TitleJobSearch, StringComparison.CurrentCultureIgnoreCase) >= 0).ToList(); }
// [OutputCache(Duration = 300, VaryByParam = "TownMode;ColorMode;StateMode;PriceMode;RubriqueMode;pageNumber;sortBy")] public async Task <ActionResult> searchOfferMode(SeachJobViewModel model, int?pageNumber, string sortBy) { ViewBag.PriceAscSort = String.IsNullOrEmpty(sortBy) ? "Price desc" : ""; ViewBag.PriceDescSort = sortBy == "Prix croissant" ? "Price asc" : ""; ViewBag.DateAscSort = sortBy == "Plus anciennes" ? "date asc" : ""; ViewBag.DateDescSort = sortBy == "Plus recentes" ? "date desc" : ""; model.CagtegorieSearch = "Mode"; model.SearchOrAskJobJob = "J'offre"; model.sortBy = sortBy; model.PageNumber = pageNumber; List <ModeModel> liste = await dal.GetListModeWithNoInclude().Where(m => m.Category.CategoryName == model.CagtegorieSearch && m.SearchOrAskJob == model.SearchOrAskJobJob).ToListAsync(); if (!string.IsNullOrWhiteSpace(model.TownMode)) { liste = liste.Where(m => m.Town == model.TownMode).ToList(); } if (!string.IsNullOrWhiteSpace(model.ColorMode)) { liste = liste.Where(m => m.ColorMode == model.ColorMode).ToList(); } if (!string.IsNullOrWhiteSpace(model.StateMode)) { liste = liste.Where(m => m.StateMode == model.StateMode).ToList(); } if (model.PriceMode > 0) { liste = liste.Where(m => m.Price < model.PriceMode).ToList(); } switch (model.RubriqueMode) { case "Vêtements": liste = liste.Where(m => m.RubriqueMode == model.RubriqueMode).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeModeClothes)) { liste = liste.Where(m => m.TypeMode == model.TypeModeClothes).ToList(); } if (!string.IsNullOrWhiteSpace(model.BrandModeClothes)) { liste = liste.Where(m => m.BrandMode == model.BrandModeClothes).ToList(); } if (!string.IsNullOrWhiteSpace(model.SizeModeClothes)) { liste = liste.Where(m => m.SizeMode == model.SizeModeClothes).ToList(); } break; case "Chaussures": liste = liste.Where(m => m.RubriqueMode == model.RubriqueMode).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeModeShoes)) { liste = liste.Where(m => m.TypeMode == model.TypeModeShoes).ToList(); } if (!string.IsNullOrWhiteSpace(model.BrandModeShoes)) { liste = liste.Where(m => m.BrandMode == model.BrandModeShoes).ToList(); } if (!string.IsNullOrWhiteSpace(model.SizeModeShoes)) { liste = liste.Where(m => m.SizeMode == model.SizeModeShoes).ToList(); } break; case "Accesoires & Bagagerie": liste = liste.Where(m => m.RubriqueMode == model.RubriqueMode).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeModeAccesorieLugages)) { liste = liste.Where(m => m.TypeMode == model.TypeModeAccesorieLugages).ToList(); } if (!string.IsNullOrWhiteSpace(model.BrandModeClothes)) { liste = liste.Where(m => m.BrandMode == model.BrandModeClothes).ToList(); } break; case "Montres & Bijoux": liste = liste.Where(m => m.RubriqueMode == model.RubriqueMode).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeModeWatchJewelry)) { liste = liste.Where(m => m.TypeMode == model.TypeModeWatchJewelry).ToList(); } if (!string.IsNullOrWhiteSpace(model.BrandModeClothes)) { liste = liste.Where(m => m.BrandMode == model.BrandModeClothes).ToList(); } break; case "Equipement bébé": liste = liste.Where(m => m.RubriqueMode == model.RubriqueMode).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeModeBabyEquipment)) { liste = liste.Where(m => m.TypeMode == model.TypeModeBabyEquipment).ToList(); } if (!string.IsNullOrWhiteSpace(model.BrandModeClothes)) { liste = liste.Where(m => m.BrandMode == model.BrandModeClothes).ToList(); } break; case "Vêtements bébé": liste = liste.Where(m => m.RubriqueMode == model.RubriqueMode).ToList(); if (!string.IsNullOrWhiteSpace(model.TypeModeBabyClothes)) { liste = liste.Where(m => m.TypeMode == model.TypeModeBabyClothes).ToList(); } if (!string.IsNullOrWhiteSpace(model.BrandModeClothes)) { liste = liste.Where(m => m.BrandMode == model.BrandModeClothes).ToList(); } if (!string.IsNullOrWhiteSpace(model.SizeModeClothes)) { liste = liste.Where(m => m.SizeMode == model.SizeModeClothes).ToList(); } break; } // TempData["listeMode"] = liste; model.ListePro = new List <ProductModel>(); model.ListeProMode = liste; switch (model.sortBy) { case "Price desc": model.ListeProMode = model.ListeProMode.OrderByDescending(m => m.Price).ToList(); model.ListeProPagedList = model.ListeProMode.ToPagedList(model.PageNumber ?? 1, 10); break; case "Price asc": model.ListeProMode = model.ListeProMode.OrderBy(m => m.Price).ToList(); model.ListeProPagedList = model.ListeProMode.ToPagedList(model.PageNumber ?? 1, 10); break; case "date desc": model.ListeProMode = model.ListeProMode.OrderByDescending(m => m.DateAdd).ToList(); model.ListeProPagedList = model.ListeProMode.ToPagedList(model.PageNumber ?? 1, 10); break; case "date asc": model.ListeProMode = model.ListeProMode.OrderBy(m => m.DateAdd).ToList(); model.ListeProPagedList = model.ListeProMode.ToPagedList(model.PageNumber ?? 1, 10); break; default: model.ListeProMode = model.ListeProMode.OrderByDescending(x => x.DateAdd).ToList(); model.ListeProPagedList = model.ListeProMode.ToPagedList(model.PageNumber ?? 1, 10); break; } return(View("FilterSearchMode", model)); // return RedirectToAction("ResultSearch_PartialView", "Product", model); }
public JsonResult ResultSearchJson(SeachJobViewModel modelresult, AskJobViewModel model) { List <JobModel> result = TempData["listeJobJson"] as List <JobModel>; List <MultimediaModel> resultMultimedia = TempData["listeMulti_Json"] as List <MultimediaModel>; List <VehiculeModel> resultVehicule = TempData["listeVehicule_Json"] as List <VehiculeModel>; List <ModeModel> resultMode = TempData["listeMode_json"] as List <ModeModel>; List <HouseModel> resultHouse = TempData["listeHouse_json"] as List <HouseModel>; List <ProductModel> resultSearchAsk = TempData["listeSearchAsk_json"] as List <ProductModel>; List <ApartmentRentalModel> resultImmobilier = TempData["listeApartJson"] as List <ApartmentRentalModel>; List <DataJsonProductViewModel> data = new List <DataJsonProductViewModel>(); if (modelresult.CagtegorieSearch != null) { switch (modelresult.CagtegorieSearch) { case "Emploi": if (result != null) { foreach (var element in result) { modelresult.ListePro.Add(element); } } data = modelresult.ListePro.Select(s => new DataJsonProductViewModel { Title = s.Title, Lat = s.Coordinate.Lat, Lon = s.Coordinate.Lon, id = s.id, Images = s.Images.Select(o => o.Image).FirstOrDefault(), Town = s.Town, Category = s.Category.CategoryName }).ToList(); break; case "Immobilier": if (resultImmobilier != null) { foreach (var element in resultImmobilier) { modelresult.ListePro.Add(element); } } data = modelresult.ListePro.Select(s => new DataJsonProductViewModel { Title = s.Title, Lat = s.Coordinate.Lat, Lon = s.Coordinate.Lon, id = s.id, Images = s.Images.Select(m => m.Image).FirstOrDefault(), Town = s.Town, Category = s.Category.CategoryName }).ToList(); break; case "Multimedia": if (resultMultimedia != null) { foreach (var element in resultMultimedia) { modelresult.ListePro.Add(element); } } data = modelresult.ListePro.Select(s => new DataJsonProductViewModel { Title = s.Title, Lat = s.Coordinate.Lat, Lon = s.Coordinate.Lon, id = s.id, Images = s.Images.Select(o => o.Image).FirstOrDefault(), Town = s.Town, Category = s.Category.CategoryName }).ToList(); break; case "Vehicule": if (resultVehicule != null) { foreach (var element in resultVehicule) { modelresult.ListePro.Add(element); } } data = modelresult.ListePro.Select(s => new DataJsonProductViewModel { Title = s.Title, Lat = s.Coordinate.Lat, Lon = s.Coordinate.Lon, id = s.id, Images = s.Images.Select(o => o.Image).FirstOrDefault(), Town = s.Town, Category = s.Category.CategoryName }).ToList(); break; case "Mode": if (resultMode != null) { foreach (var element in resultMode) { modelresult.ListePro.Add(element); } } data = modelresult.ListePro.Select(s => new DataJsonProductViewModel { Title = s.Title, Lat = s.Coordinate.Lat, Lon = s.Coordinate.Lon, id = s.id, Images = s.Images.Select(o => o.Image).FirstOrDefault(), Town = s.Town, Category = s.Category.CategoryName }).ToList(); break; case "Maison": if (resultHouse != null) { foreach (var element in resultHouse) { modelresult.ListePro.Add(element); } } data = modelresult.ListePro.Select(s => new DataJsonProductViewModel { Title = s.Title, Lat = s.Coordinate.Lat, Lon = s.Coordinate.Lon, id = s.id, Images = s.Images.Select(o => o.Image).FirstOrDefault(), Town = s.Town, Category = s.Category.CategoryName }).ToList(); break; } } else { modelresult = new SeachJobViewModel(); modelresult.ListePro = new List <ProductModel>(); try { foreach (var element in resultSearchAsk) { modelresult.ListePro.Add(element); } data = modelresult.ListePro.Select(s => new DataJsonProductViewModel { Title = s.Title, Lat = s.Coordinate.Lat, Lon = s.Coordinate.Lon, id = s.id, Images = s.Images.Select(o => o.Image).FirstOrDefault(), Town = s.Town, Category = s.Category.CategoryName }).ToList(); } catch (Exception e) { Console.WriteLine(e.ToString()); } } if (modelresult.ListePro == null) { modelresult.ListePro = new List <ProductModel>(); } return(Json(data, JsonRequestBehavior.AllowGet)); }
public async Task <JsonResult> ResultSearchOfferApart_Jason(string type, string town, int minSurface, int maxSurface, string furnitureOrNot, int roomNumber, int minPrice, int maxPrice) { SeachJobViewModel model = new SeachJobViewModel(); model.Type = type; model.TownSearch = town; model.MinApartSurface = minSurface; model.MaxApartSurface = maxSurface; model.PriceMinSearch = minPrice; model.PriceMaxSearch = maxPrice; model.FurnitureOrNot = furnitureOrNot; model.RoomNumber = roomNumber; model.CagtegorieSearch = "Immobilier"; model.SearchOrAskJobJob = "J'offre"; List <ApartmentRentalModel> liste = await dal.GetListAppartWithNoInclude().Where(m => m.Category.CategoryName == model.CagtegorieSearch && m.SearchOrAskJob == model.SearchOrAskJobJob).ToListAsync(); if (!string.IsNullOrWhiteSpace(model.TownSearch)) { liste = liste.Where(m => m.Town == model.TownSearch).ToList(); } if (!string.IsNullOrWhiteSpace(model.Type)) { liste = liste.Where(m => m.Type == model.Type).ToList(); } if (model.MaxApartSurface > 0 && model.MinApartSurface >= 0 && model.MaxApartSurface > model.MinApartSurface) { liste = liste.Where(m => m.ApartSurface <= model.MaxApartSurface && m.ApartSurface >= model.MinApartSurface).ToList(); } else if (model.MinApartSurface >= 0) { liste = liste.Where(m => m.ApartSurface >= model.MinApartSurface).ToList(); } else if (model.MaxApartSurface > 0) { liste = liste.Where(m => m.ApartSurface <= model.MaxApartSurface).ToList(); } if (model.PriceMaxSearch > 0 && model.PriceMinSearch >= 0 && model.PriceMinSearch > model.PriceMinSearch) { liste = liste.Where(m => m.Price <= model.PriceMaxSearch && m.Price >= model.PriceMinSearch).ToList(); } else if (model.PriceMinSearch >= 0) { liste = liste.Where(m => m.Price >= model.PriceMinSearch).ToList(); } else if (model.PriceMaxSearch > 0) { liste = liste.Where(m => m.Price <= model.PriceMaxSearch).ToList(); } if (model.Type != "Terrain à vendre") { if (model.RoomNumber > 0) { liste = liste.Where(m => m.RoomNumber == model.RoomNumber).ToList(); } if (model.FurnitureOrNot != null) { liste = liste.Where(m => m.FurnitureOrNot != model.FurnitureOrNot).ToList(); } } //TempData["listeApartJson"] = liste; var data = liste.Select(s => new DataJsonProductViewModel { Title = s.Title, Lat = s.Coordinate.Lat, Lon = s.Coordinate.Lon, id = s.id, Images = s.Images.Select(m => m.Image).FirstOrDefault(), Town = s.Town, Category = s.Category.CategoryName }).ToList(); //model.ListePro = new List<ProductModel>(); return(Json(data, JsonRequestBehavior.AllowGet)); }