Dibyajyoti Palata

Dibyajyoti Palata

  • NA
  • 273
  • 13.2k

How to get a single employee details using entity framework.

Apr 16 2020 2:24 PM
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MVCWebApp.Models;
namespace MVCWebApp.Controllers
{
public class EmployeeController : Controller
{
// GET: Employee
public ActionResult Details(int id)
{
EmployeeContext employeeContext = new EmployeeContext();
EmployeeModel employees = employeeContext.Employee.Single(emp => emp.ID==id);
return View(employees);
}
}
}
 
Error:
 
 
 

Answers (3)