I'm currently trying to implement an Angular keyvaluepair and my goal is to pass the following data structure to my Angular type lawyers: { [key: number]: string };
{2: 'foo', 1: 'bar'};
Once processed in the controller, I need to send this data back to the user interface.
Below is a snippet of my controller:
[HttpGet("check/{matter}")]
public async Task<IActionResult> SearchMatter(string matter)
{
var exists = await _cmpRepo.CheckMatter(matter);
if (!exists)
return BadRequest("error");
var claims = await _autoRepo.GetClaimsByMatter(matter);
var attorneys = await _autoRepo.GetAttorneys();
return Ok(new ClaimInfo { Names = claims, Attorneys = attorneys });
}
Here's a glimpse at the code for ClaimInfo.cs
public class ClaimInfo
{
public IEnumerable<string> Names { get; set; }
public IEnumerable<KeyValuePair<int, string>> Attorneys { get; set; }
}