public async Task <IEnumerable <TestResultModel> > Gettest(TestInfoModel para) { var data = await this._testRepository.GetTest(); var result = _mapper.Map <IEnumerable <TestDataModel>, IEnumerable <TestResultModel> >(data); return(result); }
private static async void ChangeStyleOfLabelsAsync(TestInfoModel model, bool change) { if (change) { await Task.Run(() => { model.LabelNameColor = GetColor(Filter == FilterMode.Name); model.LabelDateColor = GetColor(Filter == FilterMode.Date); model.LabelSubjectColor = GetColor(Filter == FilterMode.Subject); }); } }
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { TestInfoModel model = value as TestInfoModel; if (model == null) { return(Visibility.Collapsed); } if (model.Valid == TestState.Error) { return(IsError ? Visibility.Visible : Visibility.Collapsed); } return(IsError ? Visibility.Collapsed : Visibility.Visible); }
TestInfoModel GetValidTestInfoModel(int rowHandle) { if (!Grid.IsValidRowHandle(rowHandle) || Grid.IsGroupRowHandle(rowHandle)) { return(null); } TestInfoModel testInfoModel = Grid.GetRow(rowHandle) as TestInfoModel; if (testInfoModel == null || testInfoModel.Valid == TestState.Error) { return(null); } return(testInfoModel); }
public ActionResult ExamsInfo(int Employeeid) { fillUserData(); var employee = db .Employees .Where(e => e.Id == Employeeid) .FirstOrDefault(); var registrations = db .Registrations .Include("Test") .Include("Test.TestXQuestions") .Include("Test.TestXQuestions.Question") .Include("TestXPapers") .Where(reg => reg.EmployeeId == Employeeid); List <TestInfoModel> tests = new List <TestInfoModel>(); foreach (var reg in registrations) { TestInfoModel test = new TestInfoModel() { TestId = reg.TestId, TestName = reg.Test.Name, TotalMark = reg.Test.TestXQuestions.Take(reg.Test.QuestionLimit).Sum(txq => txq.Question.points), MarkScored = reg.TestXPapers.Sum(txp => txp.MarkScored) }; tests.Add(test); } ExamsInfoViewModel examsInfoViewModel = new ExamsInfoViewModel() { EmployeeId = Employeeid, EmployeeName = employee.Name, Tests = tests }; return(View(examsInfoViewModel)); }
private static bool FilterBy(TestInfoModel model, string keyword, FilterMode filter) { var itContain = false; switch (filter) { case FilterMode.Name: itContain = model.Name.ToLower().Contains(keyword.ToLower()); break; case FilterMode.Subject: itContain = model.Subject.ToLower().Contains(keyword.ToLower()); break; case FilterMode.Date: itContain = model.Date.ToLower().Contains(keyword.ToLower()); break; } ChangeStyleOfLabelsAsync(model, itContain); return(itContain); }