Example #1
0
        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));
        }
Example #2
0
        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();
 }
Example #4
0
 public Login()
 {
     InitializeComponent();
     service         = new EmpleadosService();
     this.ControlBox = false;
 }
Example #5
0
 public EmpleadosForm()
 {
     service = new EmpleadosService();
     InitializeComponent();
 }