public ViewResult Index(string txtSearch) { IQueryable <PromotionViewModel> q = PromotionRepository.GetAllPromotion() .Select(item => new PromotionViewModel { Id = item.Id, CreatedUserId = item.CreatedUserId, //CreatedUserName = item.CreatedUserName, CreatedDate = item.CreatedDate, ModifiedUserId = item.ModifiedUserId, //ModifiedUserName = item.ModifiedUserName, ModifiedDate = item.ModifiedDate, Name = item.Name, StartDate = item.StartDate, EndDate = item.EndDate, IsAllProduct = item.IsAllProduct, Code = item.Code, PercentValue = item.PercentValue }).OrderByDescending(m => m.ModifiedDate); ViewBag.SuccessMessage = TempData["SuccessMessage"]; ViewBag.FailedMessage = TempData["FailedMessage"]; ViewBag.AlertMessage = TempData["AlertMessage"]; return(View(q)); }