protected void cmdGetData_Click(object sender, EventArgs e) { // Create the proxy. EmployeesService proxy = new EmployeesService(); // This timeout will apply to all web service method calls. proxy.Timeout = 3000; // 3,000 milliseconds is 3 seconds. DataSet ds = null; try { // Call the web service and get the results. ds = proxy.GetEmployees(); } catch (System.Net.WebException err) { if (err.Status == WebExceptionStatus.Timeout) { lblResult.Text = "Web service timed out after 3 seconds."; } else { lblResult.Text = "Another type of problem occurred."; } } // Bind the results. if (ds != null) { GridView1.DataSource = ds.Tables[0]; GridView1.DataBind(); } }
protected void cmdGetData_Click(object sender, EventArgs e) { // Create the proxy. EmployeesService proxy = new EmployeesService(); // Call the web service and get the results. GridView1.DataSource = proxy.GetEmployees(); GridView1.DataBind(); }
public IEnumerable <EmployeeSummary> GetEmployees(Guid?departmentId = null, string city = null) { using (var service = new EmployeesService()) { var employees = service.GetEmployees(); return(FilterEmployees(employees, departmentId, city) .Select(employee => ConvertToEmployeeSummary(employee))); } }
protected void cmdGetData_Click(object sender, EventArgs e) { // Create the proxy. EmployeesService proxy = new EmployeesService(); Uri newUrl = new Uri(proxy.Url); proxy.Url = newUrl.Scheme + "://" + newUrl.Host + ":8080" + newUrl.AbsolutePath; // Call the web service and get the results. GridView1.DataSource = proxy.GetEmployees(); GridView1.DataBind(); }
public IActionResult Get() { try { var employeList = _employeeService.GetEmployees(); return(Ok(employeList)); } catch { return(BadRequest()); } }
private void cmdGetData_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; // Create the proxy. EmployeesService proxy = new EmployeesService(); // Bind the results. dataGridView1.DataSource = proxy.GetEmployees(); this.Cursor = Cursors.Default; }
private void cmdGetEmployees_Click(object sender, System.EventArgs e) { this.Cursor = Cursors.WaitCursor; // Create the proxy. EmployeesService proxy = new EmployeesService(); // Call the web service and get the results. DataSet ds = proxy.GetEmployees(); // Bind the results. dataGrid1.DataSource = ds.Tables[0]; this.Cursor = Cursors.Default; }
private void cmdGetData_Click(object sender, System.EventArgs e) { // Create the proxy. EmployeesService proxy = new EmployeesService(); // Uncomment these lines to use the tracing utility // (described in Chapter 25). //Uri newUrl = new Uri(proxy.Url); //proxy.Url = newUrl.Scheme + "://" + newUrl.Host + ":8080" + newUrl.AbsolutePath; // Call the web service and get the results. DataSet ds = proxy.GetEmployees(); // Bind the results. DataGrid1.DataSource = ds; DataGrid1.DataBind(); }
public void ShouldReturnEmptyListWhenNoEmployees() { //Arrange var mockedRepository = new Mock <IEfRepository <Employee> >(); var mockedUnitOfWork = new Mock <IUnitOfWork>(); var mockedImageService = new Mock <IImageService>(); var employees = new List <Employee>(); mockedRepository.Setup(x => x.GetAll()).Returns(employees); var service = new EmployeesService(mockedRepository.Object, mockedUnitOfWork.Object, mockedImageService.Object); //Act var result = service.GetEmployees(); //Assert Assert.IsNotNull(result); Assert.AreEqual(0, result.Count()); }
private void cmdSynchronous_Click(object sender, System.EventArgs e) { // Record the start time. DateTime startTime = DateTime.Now; // Get the web service data. EmployeesService proxy = new EmployeesService(); DataGrid1.DataSource = proxy.GetEmployees(); DataGrid1.DataBind(); // Perform some other time-consuming tasks. DoSomethingSlow(); // Determine the total time taken. TimeSpan timeTaken = DateTime.Now.Subtract(startTime); lblInfo.Text = "Synchronous operations took " + timeTaken.TotalSeconds + " seconds."; }
public void ShouldReturnAll() { //Arrange var mockedRepository = new Mock <IEfRepository <Employee> >(); var mockedUnitOfWork = new Mock <IUnitOfWork>(); var mockedImageService = new Mock <IImageService>(); var employees = new List <Employee>() { new Employee { FirstName = "qweqwe" } }.AsQueryable(); mockedRepository.Setup(x => x.GetAllQueryable).Returns(employees); var service = new EmployeesService(mockedRepository.Object, mockedUnitOfWork.Object, mockedImageService.Object); //Act var result = service.GetEmployees(); //Assert Assert.IsNotNull(result); Assert.AreEqual(1, result.Count()); }
public IEnumerable <AppUserDto> Get() { return(_empService.GetEmployees()); }
public IActionResult Get() { var allBooks = _employeesService.GetEmployees(); return(Ok(allBooks)); }