Exemplo n.º 1
0
 public ActionResult GetAllEmployeeRecords()
 {
     using (var context = new EmployeeDBBEntities())
     {
         empList = context
                   .Employees
                   .ToList();
     }
     return(PartialView("_EmployeeList", empList));
 }
Exemplo n.º 2
0
        public ActionResult Delete(Employee employee)
        {
            using (var context = new EmployeeDBBEntities())
            {
                var empRecord = context.Employees.Find(employee.EmployeeID);
                context.Employees.Remove(empRecord);
                context.SaveChanges();
            }

            //Once the record is inserted , then notify all the subscribers (Clients)
            EmployeeHub.NotifyCurrentEmployeeInformationToAllClients();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        public ActionResult Insert(Employee employee)
        {
            if (ModelState.IsValid)
            {
                //Insert into Employee table
                using (var context = new EmployeeDBBEntities())
                {
                    context.Employees.Add(employee);
                    context.SaveChanges();
                }
            }

            //Once the record is inserted , then notify all the subscribers (Clients)
            EmployeeHub.NotifyCurrentEmployeeInformationToAllClients();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
        public ActionResult Update(Employee employee)
        {
            using (var context = new EmployeeDBBEntities())
            {
                var empRecord = context.Employees.Find(employee.EmployeeID);

                empRecord.EmployeeName = employee.EmployeeName;
                empRecord.EmailAdress  = employee.EmailAdress;
                empRecord.MobileNumber = employee.MobileNumber;

                context.Employees.Add(empRecord);

                context.Entry(empRecord).State = EntityState.Modified;
                context.SaveChanges();
            }

            //Once the record is inserted , then notify all the subscribers (Clients)
            EmployeeHub.NotifyCurrentEmployeeInformationToAllClients();
            return(RedirectToAction("Index"));
        }