Good morning
My query is the following one I would like to know how I can do to move by a list, object by object showing me the information registry by registry. I mean, I have my first actionResult that receives the information to generate the list.
[HttpPost]
public ActionResult Index(VariablesEntrada datos)
{
DateTime fecha = datos.fecha;
string fechaformateada = fecha.ToString();
short NumProceso = datos.numEntrega;
return RedirectToAction("Trabajo", new RouteValueDictionary(
new { controller = "ControlCalidadFir", action = "Trabajo", Id = 0 , fechaProceso = fechaformateada, NumProceso = NumProceso }));// RedirectToAction es para pasar valores entre acciones del mismos controlador
}
By passing it the date and process parameters it goes and fills the entire list. and then I take an object from that list and I can see it.
public ActionResult Trabajo(int Id, string fechaProceso, short NumProceso )
{
List<ControlCalidadFir> listadoOut = new List<ControlCalidadFir>();
ConexionBDReplicaSOS Listadoin = new ConexionBDReplicaSOS();
listadoOut = Listadoin.ConsultaCalidadFIR(fechaProceso, NumProceso);
foreach (var item in listadoOut)
{
//listadofinal = listado;
int posicion = Id;
int posicionac = BottonSiguiente(Id);
if (posicion < 0)
{
posicion = 0;
Id = 0;
}
// posicion = 1;
var numero = listadoOut[posicion];// objeto en la posicion 0
string nuevaImagen = "convirtio";
//conviterte tiff a png
// Image imageFile = Image.FromFile(numero.Url);
Bitmap.FromFile(numero.Url)
.Save(@"C:\Windows\Temp\" + nuevaImagen + ".png", System.Drawing.Imaging.ImageFormat.Png);
//cierra
string imagenpng = @"C:\Windows\Temp\convirtio.png";
byte[] imageByteData = System.IO.File.ReadAllBytes(imagenpng);
string imageBase64Data = Convert.ToBase64String(imageByteData);
// string imageDataURL = string.Format(imageBase64Data);
ViewBag.ImageData = imageBase64Data;
//Llama la ayuda de tipos de afiliacion
cargaCombos();
ViewBag.contador = posicion;
return View(numero);
}
return View();
}
but I need to move one by one of the registers with a next button and one back, so that the user can move through the list. The problem I have is the position in which the list is, as an example: if the user gives the next has to go to the next record, but I do not know how to weigh that position to the action because if I send it to the same action of work I will always want to load the list and that would be very bad for the database. Also, as the action needs two parameters, these will be lost and generate a null error. Then I need to keep the list full and move through the records at the mercy of where the user wants to go.
Thanks