public async Task <IActionResult> Index(QueryEmployees query) { return(View(new EmployeesViewModel { Query = query, Employees = await _mediator.Process(query), })); }
public async Task <IActionResult> Index() { var query = new QueryEmployees(); return(View(new EmployeesViewModel { Query = query, Alert = (string)TempData[nameof(EmployeesViewModel.Alert)], Employees = await _mediator.Process(query) })); }
public async Task Sorts_MobilePhone_descending( [Frozen, Greedy] EmployeeContext db, Employee[] employees, QueryEmployees request, QueryEmployeesHandler sut) { await db.Employees.AddRangeAsync(employees); await db.SaveChangesAsync(); request.Sort = nameof(Employee.MobilePhone) + "_desc"; var result = await sut.Handle(request); result.Should().BeInDescendingOrder(_ => _.MobilePhone); }
public async Task Filters_whose_LastName_contains_string( [Frozen, Greedy] EmployeeContext db, Employee[] employees, QueryEmployees request, QueryEmployeesHandler sut) { employees[0].LastName = employees[0].LastName.Insert(10, request.Search); await db.Employees.AddRangeAsync(employees); await db.SaveChangesAsync(); request.Sort = nameof(Employee.MobilePhone) + "_desc"; var result = await sut.Handle(request); result.Should().ContainSingle() .Which.Should().BeEquivalentTo(employees[0]); }