public ViewResult ResponderPeticion(int id_tramite_realizado, int id_dato, string cedula) { PINTAE_Service1.Service1 servicio = new PINTAE_Service1.Service1(); string nombreMIMTipodato = servicio.GetNombreCatalogoTipoDato(id_dato, true); if (nombreMIMTipodato == "-1") { ViewBag.Error = 1; return(View()); } //Error de conexión. else if (nombreMIMTipodato == "-2" || nombreMIMTipodato == "") { ViewBag.Error = 2; return(View()); } //No hay trámites para esa cedula. else { PeticionDato peticion = new PeticionDato(); peticion.Cedula = cedula; peticion.Id_dato = id_dato; peticion.Id_tramite_solicitado = id_tramite_realizado; peticion.Nombre_dato = nombreMIMTipodato; ViewBag.TipoDato = nombreMIMTipodato; Session["Peticion"] = peticion; return(View()); } }
public ActionResult ResponderPeticion(HttpPostedFileBase file) { if (file != null && file.ContentLength > 0) { // Get file info var fileName = Path.GetFileName(file.FileName); var contentLength = file.ContentLength; var contentType = file.ContentType; // Get file data byte[] data = new byte[] { }; using (var binaryReader = new BinaryReader(file.InputStream)) { data = binaryReader.ReadBytes(file.ContentLength); } PeticionDato peticion = (PeticionDato)Session["Peticion"]; PINTAE_Service1.Service1 servicio = new PINTAE_Service1.Service1(); string response = servicio.CallProcEntregarDato(peticion.Id_dato, true, peticion.Id_tramite_solicitado, true, data, peticion.Cedula); if (response == "1") { return(RedirectToAction("ConsultaPeticiones")); } else { return(RedirectToAction("ConsultaPeticiones")); } } else { // Show error ... return(View("Foo")); } }