public int SaveAsk(string token, string id, AskDelyvery askDelyvery, ref string description) { IRestResponse response = null; string content = null; try { string strJsonAsk = JsonConvert.SerializeObject(askDelyvery); RestClient client = new RestClient(Config.BaseReqvesteUrl); RestRequest request = new RestRequest("Mobile/Save/Ansver", Method.POST); request.AddHeader("Accept", "application/json"); client.Timeout = 60000; request.AddParameter("token", token); request.AddParameter("idVe", id); request.AddParameter("jsonStrAsk", Compress(strJsonAsk)); request.AddParameter("type", 4); response = client.Execute(request); content = response.Content; } catch (Exception) { return(4); } if (content == "" || response.StatusCode == System.Net.HttpStatusCode.NotFound) { return(4); } else { return(GetData(content, ref description)); } }
public void SaveAskDelyveryInDb(string idve, AskDelyvery askDelyvery) { VehiclwInformation vehiclwInformation = context.VehiclwInformation.FirstOrDefault(v => v.Id == Convert.ToInt32(idve)); vehiclwInformation.AskDelyvery = askDelyvery; context.SaveChanges(); }
public async Task SaveAsk(string id, int type, string jsonStrAsk) { if (type == 1) { Ask ask = JsonConvert.DeserializeObject <Ask>(jsonStrAsk); sqlCommandApiMobile.SaveAskInDb(id, ask); } else if (type == 2) { Ask1 ask1 = JsonConvert.DeserializeObject <Ask1>(jsonStrAsk); sqlCommandApiMobile.SaveAsk1InDb(id, ask1); } else if (type == 3) { AskFromUser askFromUser = JsonConvert.DeserializeObject <AskFromUser>(jsonStrAsk); sqlCommandApiMobile.SaveAskFromUserInDb(id, askFromUser); } else if (type == 4) { AskDelyvery askDelyvery = JsonConvert.DeserializeObject <AskDelyvery>(jsonStrAsk); sqlCommandApiMobile.SaveAskDelyveryInDb(id, askDelyvery); } else if (type == 5) { AskForUserDelyveryM askForUserDelyveryM = JsonConvert.DeserializeObject <AskForUserDelyveryM>(jsonStrAsk); sqlCommandApiMobile.SaveAskForUserDelyveryInDb(id, askForUserDelyveryM); } else if (type == 6) { Ask2 ask2 = JsonConvert.DeserializeObject <Ask2>(jsonStrAsk); sqlCommandApiMobile.SaveAsk2InDb(id, ask2); } else if (type == 7) { List <Photo> photo = JsonConvert.DeserializeObject <List <Photo> >(jsonStrAsk); sqlCommandApiMobile.SavePhotoinTruckInDb(id, photo); } else if (type == 8) { List <Photo> photo = JsonConvert.DeserializeObject <List <Photo> >(jsonStrAsk); sqlCommandApiMobile.SavePhotoStrapInDb(id, photo); } }