public ActionResult GetTests(AjaxGridRequest model) { var tests = TestService.GetAll(); if (!User.IsCompany) { tests = tests.Where(x => x.Status == TestStatus.Edit); } if (User.IsCompany) { tests = tests.Where(x => x.CompanyId == User.CompanyID); } else if (User.InRole(Role.Admin)) { } else if (User.IsEmployee) { tests = tests.Where(x => x.Author_TC == User.Employee_TC); } var list = tests.Select(x => new { x.Id, x.Name, x.Status }) .ToPagedList(model.Page - 1, model.Rows); return(Json(new GridData(list.PageCount, model.Page, list.Count, list.Select(x => new { x.Id, x.Name, Status = NamedIdCache <TestStatus> .GetName(x.Status) })), JsonRequestBehavior.AllowGet)); }
TagA GetStatus(int setId) { var userTest = Model.Statuses.GetValueOrDefault(setId); if (userTest == null) { return(null); } return(Url.UserTestLink(userTest, NamedIdCache <UserTestStatus> .GetName(userTest.Status)) .Class("not-link open-in-uidialog")); }
TagTable Users(List <UserTest> userTests) { return(H.table[H.Head("ФИО", "Правильно", "Неправильно", "Статус"), userTests.Select(x => H.Row(Url.TestRun().UserTestAnswers(x.Id, Model.UserNames[x.UserId]) .Class("not-link open-in-uidialog"), x.RightCount, x.WrongCount, NamedIdCache <UserTestStatus> .GetName(x.Status) ))] .Class("defaultTable")); }