public JsonResult GetCliente() { var draw = Request.Form.GetValues("draw").FirstOrDefault(); var start = Request.Form.GetValues("start").FirstOrDefault(); var length = Request.Form.GetValues("length").FirstOrDefault(); var sortColumn = Request.Form.GetValues("columns[" + Request.Form.GetValues("order[0][column]").FirstOrDefault() + "][name]").FirstOrDefault(); var sortColumnDir = Request.Form.GetValues("order[0][dir]").FirstOrDefault(); var searchValue = Request.Form.GetValues("search[value]").FirstOrDefault(); int pageSize = length != null?Convert.ToInt32(length) : 0; int skip = start != null?Convert.ToInt32(start) : 0; int recordsTotal = 0; var customerData = _clienteBl.Get(); if (!(string.IsNullOrEmpty(sortColumn) && string.IsNullOrEmpty(sortColumnDir))) { //customerData = customerData.OrderBy(sortColumn + " " + sortColumnDir); } //Search if (!string.IsNullOrEmpty(searchValue)) { customerData = customerData.Where(m => m.Nombre == searchValue); } //total number of rows count recordsTotal = customerData.Count(); //Paging var data = customerData.Skip(skip).Take(pageSize).ToList(); //Returning Json Data return(Json(new { draw = draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, data = data })); }
public void Get() { ClienteBl _clienteBl = new ClienteBl(); var clientes = _clienteBl.Get(); }