I am passing multiple parameters with
public async TaskOnPostEvaluareAsync(string ea, string[] ecs, string ezl)
{
return RedirectToPage("/RO/Pages/evaris/Index", new { ea, ezl, ecs });
}
and is working well, I get multiple ecs parameter when the case. The problem I have is to get data based on all those parameters at the same time
public async Task OnGetAsync(string ea, string ezl, string[]ecs)
{
if(ecs != null)
{
foreach(var dataGet in ecs)
{
EvarisListCS = await (from a in _context.EvarisCaracterSpecials.Where(s => s.OrgID == orgid && s.ECS == dataGet)
join b in _context.EvarisMains on a.ECS equals b.ECS into Temp1
from c in Temp1
join d in _context.EvarisMasuras on c.EMID equals d.EMID into Temp2
from e in Temp2
select new EvarisMasuraListCS
{
ECS = a.ECS,
OrgID = a.OrgID,
CaracterSpecial = a.Denumire,
Pericol = c.Categorie,
FormaManifestare = c.FormaManifestare,
RiscInitial = c.Risc,
Clasa = e.Clasa,
Masura = e.Masura,
RiscFinal = e.RiscFinal
}).ToListAsync();
if(EvarisListCS.Count > 0)
{
HaveListCS = true;
}
}
}
}
but I'm getting only one result. How do I get all the data if I have two or more parameters for ecs?
Thank you

Marius VasilePosted Dec 29, 2022, 1:04 PM
Ok, I got it working with
Marius VasilePosted Dec 27, 2022, 6:07 PM
I end up creating a table to store data from query that runs those parameters and display then on main page. The data I will clean with just a click. There might be problems that doesn't have a quick resolve :(
Marius VasilePosted Dec 26, 2022, 6:07 PM
Let me add a clarification. EvarisListCS model is just a View, it does not add data it just display data. foreach loop has to get lines of data for each ecs string. This I don't know how to do
Marius VasilePosted Dec 26, 2022, 2:15 PM
Following error, but this method makes sense to me
'IList' does not contain a definition for 'AddRange' and no accessible extension method 'AddRange' accepting a first argument of type 'IList' could be found (are you missing a using directive or an assembly reference?)
public IList EvarisListCS { get; set; }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using RoSafety.Data;
using RoSafety.Models;
using RoSafety.Models.RA;
Edit no.2. Is it worth to mention that EvarisListCS is not saved just displayed/
Sachin SinghPosted Dec 26, 2022, 2:12 PM
use
EvarisListCS.AddRange(res);
Marius VasilePosted Dec 26, 2022, 2:10 PM
For the second solution I have an error for
EvarisListCS.Add(res);
cannot convert from 'System.Collections.Generic.List' to 'RoSafety.Models.RA.EvarisMasuraListCS'
Marius VasilePosted Dec 26, 2022, 2:04 PM
Same error, yes
btw parameters are sent like this
https://localhost:xxxxxx/ro/pages/evaris?ecs=9a01a8b3-6d8b-4ab6-a078-42b2fff39c06&ecs=9efe95dd-0411-4d2a-8884-ad4dffe18306
Sachin SinghPosted Dec 26, 2022, 2:04 PM
otherwise you can add results to list
Sachin SinghPosted Dec 26, 2022, 2:01 PM
what happens when you do just this, does it throw error
Marius VasilePosted Dec 26, 2022, 1:41 PM
Thank you Sachin, I receive following error
CS1660: Cannot convert lambda expresssion to type 'type' because it is not a delegate type
Sachin SinghPosted Dec 26, 2022, 1:26 PM
do this instead