public ActionResult Delete(Employee employee) { using (var context = new EmployeeContext()) { 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")); }
public ActionResult GetAllEmployeeRecords() { using (var context = new EmployeeContext()) { empList = context .Employees .ToList(); } EmployeeHub.NotifyCurrentEmployeeInformationToAllClients(); return(PartialView("_EmployeeList", empList)); }
public ActionResult Insert(Employee employee) { if (ModelState.IsValid) { //Insert into Employee table using (var context = new EmployeeContext()) { context.Employees.Add(employee); context.SaveChanges(); } } //Once the record is inserted , then notify all the subscribers (Clients) EmployeeHub.NotifyCurrentEmployeeInformationToAllClients(); return(RedirectToAction("Index")); }
private ContentResult Send(SendForm form, int?ProjectId, int?TaskId, int?TeamId, int?EmployeeId) { if (ModelState.IsValid) { int MyId = SessionUser.GetUser().Id; int?newMessageId = MessageService.Create(new C.Message(form.Title, form.Message, MyId, form.ReplyTo), EmployeeId, ProjectId, TaskId, TeamId); if (newMessageId != null) { if (EmployeeId != null) { EmployeeHub.Send((int)EmployeeId); MailboxHub.Send((int)EmployeeId); } else { if (form.ReplyTo != null) { int ParentAuthor = MessageService.Get((int)form.ReplyTo).Author; MailboxHub.Send(ParentAuthor); } if (ProjectId != null) { ProjectHub.Send((int)ProjectId); } else if (TaskId != null) { TaskHub.Send((int)TaskId); } else if (TeamId != null) { TeamHub.Send((int)TeamId); } } return(new ContentResult { Content = "success" }); } } return(new ContentResult { Content = "fail" }); }
public ActionResult Update(Employee employee) { using (var context = new EmployeeContext()) { 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")); }