public ActionResult DetalleTienda(Tienda tienda) { Mall mall = (Mall)Session["Mall"]; var client = new RestClient("https://api.devrealplazaonline.com/v1/coordinates?pi_inm_c_icod=" + mall.inm_c_icod + "&ps_loc_c_ccod=" + tienda.loc_c_ccod); var request = new RestRequest(Method.GET); request.AddHeader("Postman-Token", "31bcf8d9-f3b2-4d49-b996-4f991e642505"); request.AddHeader("Cache-Control", "no-cache"); request.AddHeader("x-api-key", "TDy86NqDhGkZcdbkGeJ45sFL55o69954KjVIaU6h"); IRestResponse response = client.Execute(request); RestSharp.Deserializers.JsonDeserializer deserial = new JsonDeserializer(); var lista = deserial.Deserialize <List <Ubicacion> >(response); ViewBag.ubicaciones = lista; ViewBag.tienda = tienda; Session["Tienda"] = tienda; using (DatabaseRPEntities2 obj = new DatabaseRPEntities2()) { var x = from cons in obj.consulta select cons.query_id; int new_id = 0; foreach (int elemento in x) { new_id = elemento; } new_id += 1; Mall mimall = (Mall)Session["Mall"]; Rubro mirubro = (Rubro)Session["Rubro"]; Tienda mitienda = (Tienda)Session["Tienda"]; consulta consulta = new consulta(); consulta.query_id = new_id; consulta.user_id = (int)Session["Usuario"]; consulta.departamento = (string)Session["Departamento"]; consulta.mall = mimall.inm_c_vnomb; consulta.rubro = mirubro.rubro_c_vnomb; consulta.tienda = mitienda.nomb_com_c_vnomb; consulta.fecha = DateTime.Now; consulta.hora = DateTime.Now.TimeOfDay; obj.consulta.Add(consulta); obj.SaveChanges(); ViewBag.mensaje = "Registro de usuario exitoso."; return(View()); } }
public ActionResult Tienda(Rubro rubro) { Mall mall = (Mall)Session["Mall"]; string codigo_mall = mall.inm_c_icod; string codigo_rubro = rubro.rubro_c_yid.ToString(); List <Rubro> lista_rubros = (List <Rubro>)Session["ListaRubros"]; RestSharp.Deserializers.JsonDeserializer deserial = new JsonDeserializer(); var client2 = new RestClient("https://api.devrealplazaonline.com/v1/local?pi_inm_c_icod=" + mall.inm_c_icod + "&pi_rubro_c_yid=" + rubro.rubro_c_yid); var request2 = new RestRequest(Method.GET); request2.AddHeader("Postman-Token", "19cb3c19-d472-461d-be49-a7777430042c"); request2.AddHeader("Cache-Control", "no-cache"); request2.AddHeader("x-api-key", "TDy86NqDhGkZcdbkGeJ45sFL55o69954KjVIaU6h"); IRestResponse response2 = client2.Execute(request2); var lista_tien = deserial.Deserialize <List <Tienda> >(response2); ViewBag.lista_tiendas = lista_tien; ViewBag.Rubro = rubro; Session["Rubro"] = rubro; return(View()); }