Home > DeveloperSection > Forums > how to select and retrieve data using linq query in entity framework
Ankit Singh

Total Post:341

Posted on    January-21-2016 9:27 PM

 ASP.NET MVC LINQ  Mvc  Entity Framework 

 1 Reply(s)
 751  View(s)
Rate this:
I want to  select and retrieve data using  linq query in entity framework how to do this please help me.

aditya kumar Patel

Total Post:254

Posted on    January-21-2016 9:31 PM


@model IList<ForumMVC.CUSTOMER>
    ViewBag.Title = "WebGrid CRUD Operations";  

<table style="background-color: #ccc; width: 100%;">
    <thead style="background-color: red;">
    <tbody style="background-color: #ddd;">
        @foreach(var obj in Model)



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;
namespace ForumMVC.Controllers
    public class HomeController : Controller
        forumEntities1 db = new forumEntities1();
        public ActionResult Index()
            IList<CUSTOMER> data = db.CUSTOMER.Where(p => p.CUST_ID < 70 && p.CUST_ID > 50).ToList();
            return View(data);



Modified On Jan-22-2016 12:48:14 AM

Don't want to miss updates? Please click the below button!

Follow MindStick