public IQueryable<V_ShopJobAd> GetShopJobAds(int? shopId, int serviceAreaId, string userName,string jobName = "") { IQueryable<V_ShopJobAd> result; if(shopId != null) result = db.V_ShopJobAd.Where(r => r.ShopId == shopId.Value); else { if(!String.IsNullOrWhiteSpace(userName)) { UserModel userModel = new UserModel(); V_UserInfoDetail userInfo = userModel.GetUserInfoDetail(userName); if(userInfo.GradeLevel >= 9) result = db.V_ShopJobAd.Where(r => (r.PublishedByUserId == userInfo.Id || r.LastModifyByUserId == userInfo.Id)); else result = db.V_ShopJobAd; } else result = db.V_ShopJobAd; } return result.Where(r=> r.JobTitle.Contains(jobName) && r.AreaId == serviceAreaId).OrderByDescending(r => r.PublishedAt).ThenByDescending(r => r.OrderIndex); }
public ActionResult Index() { UserModel userModel = new UserModel(); var userInfo = userModel.GetUserInfoDetail(User.Identity.Name); ViewBag.PageName = "home"; return View(userInfo); }