public async Task <ActionResult> Index(string buscar) { /* * var empleadosService = new EmpleadosService(); * var model = empleadosService.ObtenerEmpleados(); * return View(model); */ var httpClient = new HttpClient(); var json = await httpClient.GetStringAsync("http://masglobaltestapi.azurewebsites.net/api/Employees"); var EmpleadosListaAPI = JsonConvert.DeserializeObject <List <Empleado> >(json); var empleadosService = new EmpleadosService(); var EmpleadosListaFinal = empleadosService.ObtenerResultados(EmpleadosListaAPI); // Filtramos el resultado por el 'texto de búqueda' if (!string.IsNullOrEmpty(buscar)) { EmpleadosListaFinal = EmpleadosListaFinal.Where(x => x.id.Contains(buscar)).ToList(); } return(View(EmpleadosListaFinal)); }
public ActionResult GetAllEmpleados(int page, int start, int limit, string sort, string dir, long _dc, string callback, string condicion = null, string codigo = null) { var filter = new PagingInfo { page = page, start = start, limit = limit, sort = sort, dir = dir, _dc = _dc, callback = callback, search = condicion }; var service = new EmpleadosService(); var jsondata = service.GetAllEmpleados(filter, codigo); JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); string callback1 = callback + "(" + javaScriptSerializer.Serialize(jsondata) + ");"; return(JavaScript(callback1)); }
public HabilitarEmpleados() { InitializeComponent(); service = new EmpleadosService(); }
public Login() { InitializeComponent(); service = new EmpleadosService(); this.ControlBox = false; }
public EmpleadosForm() { service = new EmpleadosService(); InitializeComponent(); }