Пример #1
0
        public ActionResult Edit(int id)
        {
            EmployeeContext employeeContext = new EmployeeContext();
            Employee employee = employeeContext.Employees.Find(id);

            return View(employee);
        }
Пример #2
0
        // GET: Employee
        public ActionResult Index()
        {
            EmployeeContext employeeContext = new EmployeeContext();
            List<Employee> employees = employeeContext.Employees.ToList();

            return View(employees);
        }
Пример #3
0
 public ActionResult DeleteConfirmed(int id)
 {
     EmployeeContext employeeContext = new EmployeeContext();
     Employee employee = employeeContext.Employees.Find(id);
     employeeContext.Employees.Remove(employee);
     employeeContext.SaveChanges();
     return RedirectToAction("Index");
 }
Пример #4
0
        public ActionResult Edit(Employee employee)
        {
            EmployeeContext employeeContext = new EmployeeContext();
            employeeContext.Entry(employee).State = System.Data.Entity.EntityState.Modified;
            employeeContext.SaveChanges();

            return RedirectToAction("Index");
        }
Пример #5
0
        public ActionResult Create(Employee employee)
        {
            EmployeeContext employeeContext = new EmployeeContext();

            employeeContext.Employees.Add(employee);
            employeeContext.SaveChanges();

            return RedirectToAction("Index");

        }