public IActionResult GetListCarTypeInfoFilterCars(int modelId, string [] param, int page = 1, int page_size = 10, string lang = "EN") { if (param.Length == 5) { List <header> headerList = ClassCrud.GetHeaders(); string body = param[0]; string modification = param[1]; string door = param[2]; string transmission = param[3]; string engine = param[4]; List <CarTypeInfo> list = ClassCrud.GetListCarTypeInfoFilterCars(modelId, body, modification, door, transmission, engine, lang); // list = list.Skip((page - 1) * page_size).Take(page_size).ToList(); var result = new { headers = headerList, items = list, cntitems = list.Count, page = page }; return(Json(result)); } return(NotFound("Проверьте параметры запроса!")); }
public IActionResult GetListCarTypeInfoFilterCars(string modelId, string [] param, int page = 1, int page_size = 10) { if (param.Length == 3) { List <header> headerList = ClassCrud.GetHeaders(); string ctrsmtyp = param[0]; string carea = param[1]; string nengnpf = param[2]; List <CarTypeInfo> list = ClassCrud.GetListCarTypeInfoFilterCars(modelId, ctrsmtyp, carea, nengnpf); // list = list.Skip((page - 1) * page_size).Take(page_size).ToList(); var result = new { headers = headerList, items = list, cntitems = list.Count, page = page }; return(Json(result)); } return(NotFound("Проверьте параметры запроса!")); }
public IActionResult GetListCarTypeInfo(string body_code, string body_num, string lang) { List <CarTypeInfo> list = ClassCrud.GetListCarTypeInfo(body_code, body_num, lang); List <header> headerList = ClassCrud.GetHeaders(); var result = new { headers = headerList, items = list, cntitems = list.Count, page = 1 }; return(Json(result)); }
public IActionResult GetListCarTypeInfo(string vin) { List <VehiclePropArr> list = ClassCrud.GetListCarTypeInfo(vin); // JHMED73600S205949 List <header> headerList = ClassCrud.GetHeaders(); var result = new { headers = headerList, items = list, cntitems = list.Count, page = 1 }; return(Json(result)); }
public IActionResult GetListCarTypeInfo(string vin, int page = 1, [FromQuery(Name = "per-page")] int qty = 10) { List <CarTypeInfo> list = ClassCrud.GetListCarTypeInfo(vin); List <header> headerList = ClassCrud.GetHeaders(8); List <CarTypeInfo> items = list.Skip((page - 1) * qty).Take(qty).ToList(); var result = new { header = headerList, items, cnt_items = list.Count, page }; return(Json(result)); }
public IActionResult GetListCarTypeInfoFilterCars(string model_id, [FromQuery(Name = "params[]")] string[] param, string brand_id = "TOYOTA", int page = 1, int page_size = 10) { List <header> headerList = ClassCrud.GetHeaders(8); List <CarTypeInfo> list = ClassCrud.GetListCarTypeInfoFilterCars(model_id, param, brand_id); // int count = list.Count; list = list.Skip((page - 1) * page_size).Take(page_size).ToList(); var result = new { header = headerList, items = list, cnt_items = count, page = page }; return(Json(result)); }
public IActionResult GetListCarTypeInfoFilterCars(string model_id, [FromQuery(Name = "params[0]")] string xcardrsP, [FromQuery(Name = "params[1]")] string dmodyrP, [FromQuery(Name = "params[2]")] string xgradefulnamP, [FromQuery(Name = "params[3]")] string ctrsmtypP, [FromQuery(Name = "params[4]")] string cmftrepcP, [FromQuery(Name = "params[5]")] string careaP, [FromQuery(Name = "params[6]")] string nengnpfP, int page = 1, int page_size = 10) { List <header> headerList = ClassCrud.GetHeaders(); List <CarTypeInfo> list = ClassCrud.GetListCarTypeInfoFilterCars(model_id, xcardrsP, dmodyrP, xgradefulnamP, ctrsmtypP, cmftrepcP, careaP, nengnpfP); list = list.Skip((page - 1) * page_size).Take(page_size).ToList(); var result = new { header = headerList, items = list, cnt_items = list.Count, page = page }; return(Json(result)); }
public HomeModule() { Get("/", args => { return(View["home.html"]); }); Get("/models", args => { List <ModelCar> list = ClassCrud.GetModelCars(); string json = JsonConvert.SerializeObject(list); return(json); }); Get("/image", args => { string image_id = this.Request.Query["image_id"]; string FilderImagePath = Ut.GetImagePath(); //"wwwroot/image/"; //image_id = "Yamato.jpg"; string fullPath = FilderImagePath + image_id; if (System.IO.File.Exists(fullPath)) { byte[] file = System.IO.File.ReadAllBytes(fullPath); string json = JsonConvert.SerializeObject(file); return(json); } var response = new Response { StatusCode = HttpStatusCode.NotFound, ReasonPhrase = "File not found!", }; return(response); }); Get("/vehicle/vin", args => { // 1HGCE17600A300001 string vin = Request.Query["vin"]; List <CarTypeInfo> list = ClassCrud.GetListCarTypeInfo(vin); // JHMED73600S205949 List <header> headerList = ClassCrud.GetHeaders(); var result = new { headers = headerList, items = list, cnt_items = list.Count, page = 1 }; return(JsonConvert.SerializeObject(result)); }); Get("/mgroups", args => { string vehicle_id = Request.Query["vehicle_id"]; string lang = Request.Query["lang"]; List <PartsGroup> list = ClassCrud.GetPartsGroup(vehicle_id, lang); return(JsonConvert.SerializeObject(list)); }); //========================================================================================= Get("/vehicle", args => { string node_id = Request.Query["node_id"]; string lang = Request.Query["lang"]; //List<SpareParts4F> list = ClassCrud.GetSpareParts(nplblk, hmodtyp, npl); DetailsInNode details = ClassCrud.GetDetailsInNode(node_id, lang); return(JsonConvert.SerializeObject(details)); }); //========================================================================================= Get("/filters", args => { string modelId = Request.Query["modelId"]; List <Filters> list = ClassCrud.GetFilters(modelId); string json = JsonConvert.SerializeObject(list); return(json); }); Get("/filter-cars", args => { List <header> headerList = ClassCrud.GetHeaders(); int page = Request.Query["page"]; int page_size = Request.Query["page_size"]; string paramStr = Request.Query["param"].Value; string[] param = paramStr.Split(","); string modelId = Request.Query["modelId"]; string ctrsmtyp = param[0]; string carea = param[1]; string nengnpf = param[2]; List <CarTypeInfo> list = ClassCrud.GetListCarTypeInfoFilterCars(modelId, ctrsmtyp, carea, nengnpf); list = list.Skip((page - 1) * page_size).Take(page_size).ToList(); var result = new { headers = headerList, items = list, cntitems = list.Count, page = page }; string json = JsonConvert.SerializeObject(result); return(json); }); Get("/vehicle/sgroups", args => { string vehicle_id = Request.Query["vehicle_id"]; string group_id = Request.Query["group_id"]; string lang = Request.Query["lang"]; List <Sgroups> list = ClassCrud.GetSgroups(vehicle_id, group_id, lang); return(JsonConvert.SerializeObject(list)); }); Get("/locales", args => { List <lang> list = ClassCrud.GetLang(); return(JsonConvert.SerializeObject(list)); }); Get("/vehicle/wmi", args => { List <string> list = ClassCrud.GetWmi(); return(JsonConvert.SerializeObject(list)); }); Get("/vehicleAttr", args => { string vehicle_id = Request.Query["vehicle_id"]; VehiclePropArr result = ClassCrud.GetVehiclePropArr(vehicle_id); return(JsonConvert.SerializeObject(result)); }); Post("/vehicle/sgroups", args => { string strCodes = Request.Query["codes"]; string strNodeIds = Request.Query["node_ids"]; string[] codes = strCodes.Split(","); string[] node_ids = strNodeIds.Split(","); List <node> list = ClassCrud.GetNodes(codes, node_ids); return(JsonConvert.SerializeObject(list)); }); }