public async Task OnGet() { if (string.IsNullOrEmpty(SearchString)) { var valori = await clt.GetAllAsync(); int ok = 1; PaginawebDTO pd = new PaginawebDTO(); foreach (var item in valori) { //Console.WriteLine(item); if (ok == 1) { pd.justID = item; } else if (ok == 2) { pd.Name = item; } else if (ok == 3) { pd.Path = item; } else if (ok == 4) { pd.Size = item; } else if (ok == 5) { pd.cDate = item; } else if (ok == 6) { pd.mDate = item; } else if (ok == 7) { pd.Extension = item; } else if (ok == 8) { pd.Resolution = item; PGO.Add(pd); ok = 0; pd = new PaginawebDTO(); } ok++; } } }
public async Task OnGet() { PaginawebDTO pd = new PaginawebDTO(); PaginawebDTO pd2 = new PaginawebDTO(); PaginawebDTO pd3 = new PaginawebDTO(); int val = 0, contor = 0; var valori = await clt.GetAllAsync(); int ok = 1; foreach (var item in valori) { if (item.Contains(SearchString)) { contor++; val++; } if (ok == 1) { pd.justID = item; } else if (ok == 2) { pd.Name = item; } else if (ok == 3) { pd.Path = item; } else if (ok == 4) { pd.Size = item; } else if (ok == 5) { pd.cDate = item; } else if (ok == 6) { pd.mDate = item; } else if (ok == 7) { pd.Extension = item; } else if (ok == 8) { pd.Resolution = item; if (val > 0) { PGO.Add(pd); if (pd.Name.Contains(".")) { pd2.Pozaname = pd.Name; } else { pd2.Pozaname = pd.Name + pd.Resolution; } PGO2.Add(pd2); val = 0; } ok = 0; pd = new PaginawebDTO(); pd2 = new PaginawebDTO(); } ok++; } string lastcontor = contor.ToString() + " '" + SearchString + "' " + " Found in Database!"; pd3.Contor = lastcontor; Console.WriteLine(lastcontor); PGO3.Add(pd3); }