public JsonResult GetBarcode(string code) { bool status = false; string data = "<h4>No results found, please scan again</h4>"; if (!code.Trim().Equals("")) { var model = new ProductDao().GetProductBarcode(int.Parse(code)); data = HtmlMvcHelper.RenderViewToString(ControllerContext, "~/Views/Shared/_LayoutProductBarcode.cshtml", model, true); status = true; } return(Json(new { data = data, status = status, }));; }
public JsonResult FindProduct(int?page, double size) { var model = new CategoryDao().GetListAllProduct(); page = page ?? 1; int start = (int)(page - 1) * pageSize; int totalPage = model.Count(); float totalNumsize = (totalPage / (float)pageSize); int numSize = (int)Math.Ceiling(totalNumsize); var filter = model.Skip(start).Take(pageSize).ToList(); string data = HtmlMvcHelper.RenderViewToString(ControllerContext, "~/Views/Shared/_LayoutListProduct.cshtml", filter, true); return(Json(new { data = data, pageCurrent = page, numSize = numSize, })); }
public JsonResult ProductPagination(int?page, string[] conditions) { var model = new CategoryDao().FilterProductBy(conditions); page = page ?? 1; int start = (int)(page - 1) * pageSize; int totalPage = model.Count(); float totalNumsize = (totalPage / (float)pageSize); int numSize = (int)Math.Ceiling(totalNumsize); var filter = model.Skip(start).Take(pageSize).ToList(); string dataHtml = HtmlMvcHelper.RenderViewToString(ControllerContext, "~/Views/Shared/_LayoutListProduct.cshtml", filter, true); return(Json(new { data = dataHtml, pageCurrent = page, numSize = numSize, conditions = conditions })); }