using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Web;
namespace ForumMVC.Models { public class Customer { public int CustomerId { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public string EmailId { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ForumMVC; using System.Data.Entity; using ForumMVC.Models; using System.Web.Script.Serialization; namespace ForumMVC.Controllers { public class HomeController : Controller {
public ActionResult Index() { string file = Server.MapPath("~/App_Data/Customer.json"); string Json = System.IO.File.ReadAllText(file); JavaScriptSerializer ser = new JavaScriptSerializer(); var list = ser.Deserialize<List<Customer>>(Json); return View(list); }
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Can you answer this question?
Write Answer1 Answers