public IActionResult Index(UserNotifyQueryDto model, [FromQuery(Name = "direction")] string direction) { ModelState.Clear(); if (direction == "pre" && model.Paging.PageNo > 1) { model.Paging.PageNo -= 1; } if (direction == "next") { model.Paging.PageNo += 1; } var result = new UserNotifyRepo(db).QueryWithPaging(model.Id, model.Content, model.StatusId, model.StartDate, model.EndDate, model.Paging); if (result != null) { model.Paging.Count = new UserNotifyRepo(db).GetCount(model.Id, model.Content, model.StatusId, model.StartDate, model.EndDate); } else { model.Paging.Count = 0; } model.Statuses = new CommonCodeRepo(db).GetCodesByType("UserInstructStatus"); model.Results = result; return(View(model)); }
public IActionResult Index() { var currentRoleId = partnerManager.GetCurrentUserRole(this.HttpContext); var permission = partnerActivity.GetPartAct("UserNotify.Query", currentRoleId); if (permission == null) { toastNotification.AddErrorToastMessage("ليس لديك الصلاحية الكافية", new ToastrOptions { Title = "" }); return(Redirect(Request.Headers["Referer"].ToString())); } var model = new UserNotifyQueryDto(); model.Statuses = new CommonCodeRepo(db).GetCodesByType("UserInstructStatus"); model.StartDate = DateTime.Today.AddMonths(-1); model.EndDate = DateTime.Today.AddDays(1); model.Paging.PageNo = 1; model.Paging.PageSize = 50; model.Paging.Count = 0; return(View(model)); }