steps to use dictonary in angular + web api
step- 1
---------angular side
export class DictonaryModel{
Dictonaryobj: any = {};
Addinfo(Key: string, Value: string) {
this.Dictonaryobj[Key] = Value;
}
}
step-2
--------angular side
let dictonaryModel= new DictonaryModel
dictonaryModel.Addinfo("id", ID);
return this.service
.post<any>(
this.Url +
'apiextention',
dictonaryModel,
pass searchmodel obj in sevice
step-3
-----api side
public class DictonaryModel
{
public IDictionary<string, string> Dictonaryobj { get; set; }
}
step-4
-----api side
[HttpPost("PostId")]
public IActionResult Getid([FromBody] DictonaryModel dictioDictonaryModel)
{
string id= dictioDictonaryModel.Dictonaryobj["id"].ToString();
}
Comments
Post a Comment