Bind JSON data to rows in a table MVC4 issue
$2-8 USD / hour
I need help with binding JSON data generated from REST API call to rows in a table in [login to view URL] is the code for Controller
public ActionResult Members()
{
var jsonString = "{\"roleMappings\":[{\"user\":{\"id\":\"4b147d87-64eb-4049-bbd3-ade96d18af89\",\"name\":\"PFRENC17\",\"actualName\":\"French, Phil (P.)\",\"displayName\":\"French, Phil (P.) (PFRENC17)\",\"email\":\"pfrenc17@[login to view URL]\",\"deleted\":false,\"deletedDate\":0,\"authenticationRealm\":\"f4191d4b-4331-4637-af6f-c89781687bf6\",\"isLockedOut\":false,\"lastLoginDate\":1502803623890,\"isDeletable\":true},\"role\":{\"id\":\"3de854ce-34ed-4b7f-9b99-9fdf04c0345c\",\"name\":\"Developer\",\"description\":\"Application Developer\",\"isDeletable\":true}},{\"user\":{\"id\":\"3afd930e-9608-4257-a962-0a82b792a6e9\",\"name\":\"RSIEGLE3\",\"actualName\":\"Siegler, Ryan (R.)\",\"displayName\":\"Siegler, Ryan (R.) (RSIEGLE3)\",\"email\":\"rsiegle3@[login to view URL]\",\"deleted\":false,\"deletedDate\":0,\"authenticationRealm\":\"f4191d4b-4331-4637-af6f-c89781687bf6\",\"isLockedOut\":false,\"lastLoginDate\":1500300166062,\"isDeletable\":true},\"role\":{\"id\":\"3de854ce-34ed-4b7f-9b99-9fdf04c0345c\",\"name\":\"Developer\",\"description\":\"Application Developer\",\"isDeletable\":true}},{\"user\":{\"id\":\"33dd9fea-4685-4505-91ba-5c0508301b56\",\"name\":\"Michael3\",\"actualName\":\"Michael (Y.)\",\"displayName\":\"Michael (Y.) (Michael3)\",\"email\":\"Michael3@[login to view URL]\",\"deleted\":false,\"deletedDate\":0,\"authenticationRealm\":\"f4191d4b-4331-4637-af6f-c89781687bf6\",\"isLockedOut\":false,\"lastLoginDate\":1522249840141,\"isDeletable\":true},\"role\":{\"id\":\"f722b338-01c1-43cb-bc53-853cfb0d2249\",\"name\":\"UC Auto Discovery\",\"description\":\"\",\"isDeletable\":false}},{\"user\":{\"id\":\"33dd9fea-4685-4505-91ba-5c0508301b56\",\"name\":\"Michael3\",\"actualName\":\"Michael (Y.)\",\"displayName\":\"Michael (Y.) (Michael3)\",\"email\":\"Michael3@[login to view URL]\",\"deleted\":false,\"deletedDate\":0,\"authenticationRealm\":\"f4191d4b-4331-4637-af6f-c89781687bf6\",\"isLockedOut\":false,\"lastLoginDate\":1522249840141,\"isDeletable\":true},\"role\":{\"id\":\"8421e59e-ce5f-477b-aa6f-0313aa1223e6\",\"name\":\"Application_Lead\",\"description\":\"Development Team Lead\",\"isDeletable\":true}},{\"user\":{\"id\":\"5599437f-68f9-4c20-bd0a-5c26d55628e1\",\"name\":\"UBLDUCD1\",\"actualName\":\"Blducd1, U (U.)\",\"displayName\":\"Blducd1, U (U.) (UBLDUCD1)\",\"deleted\":false,\"deletedDate\":0,\"authenticationRealm\":\"f4191d4b-4331-4637-af6f-c89781687bf6\",\"isLockedOut\":false,\"lastLoginDate\":1515694447960,\"isDeletable\":true},\"role\":{\"id\":\"8421e59e-ce5f-477b-aa6f-0313aa1223e6\",\"name\":\"Application_Lead\",\"description\":\"Development Team Lead\",\"isDeletable\":true}},{\"group\":{\"id\":\"7862c275-8eb2-42cf-895c-214c2826a0b8\",\"name\":\"config_viewer\",\"enabled\":true},\"role\":{\"id\":\"ba4cdbf1-6b97-436f-9b40-a7e21d8394f2\",\"name\":\"ReadOnly\",\"description\":\"Read-only access\",\"isDeletable\":true}}],\"id\":\"877eb9b9-6dd9-432d-b55a-01bd406d039a\",\"name\":\"AftImport Team\",\"isDeletable\":true}";
List<string> MemberNames = new List<string>();
var t = [login to view URL](jsonString);
var pt = t["roleMappings"];
var COUNT = 0;
foreach (var v in pt)
{
if (COUNT > 4)
{
break;
}
var p = v["user"]["name"];
[login to view URL]([login to view URL]());
COUNT++;
}
return View(MemberNames);
}
Below is the code for View
<table border="1" align="center" style="font-family:Arial; width:900px;">
<tr height="50">
<th>Member</th>
<th>Roles</th>
<th>Actions</th>
</tr>
@foreach (var d in Model)
{
<tr height="30">
<th>@d</th>
<th></th>
<th>
<button class="editbtn">Delete User</button>
<button class="editbtn">Change Role</button>
</th>
</tr> }
</table>
As I have binded json data to the "Member" field in View to the Controller, I need help with binding "Roles" field in View to
"name": "Application_Lead",
I need Roles to be displayed on web page. Typical roles in the above JSON string are "Developer", "Application Lead"
Project ID: #16935009
About the project
12 freelancers are bidding on average $6/hour for this job
Hi There , We read your project and understand your requirement. We are geard to handle such projects . As we have a team who has experience of more than 15 years in ASP.NET, C# Programming, MVC. Looking forward t More
Hello Sir, I have gone through your requirements regarding Bind JSON data to rows in a table MVC4 issue. we brief and understand your idea and preference for job as you are looking for. I have more than 7+ years More
Hello, I would like to take this assignment. I am having 14 years of experience on web development, deployment and project management. Below are my core technical skills •ASP.Net /HTML/CSS/JavaScript/JQuery •C# More
Hello, i have read your job description and fully understand your requirements. It looks like I’ll be the perfect candidate for this job because I have hands on experience in this domain. I will make all changes w More
Hello I am very much interested to work in your project. I have more than 6 years experiences in Asp.Net MVC 4,5,6, C#, EntityFramWork, Jquery, Nopcommerce, REST API, AngulaJS, Asp.Net Boilerplate, SQL Server. So, I t More