public IActionResult HRDirectorCreation(HRDirectorCreationVM data) { var compId = compRep.GetCompanyId(data.CompanyName); Op_Employee emp = new Op_Employee(); emp.Name = data.Name; emp.PhoneNumber = "0000"; emp.Email = data.Email; emp.Address = "0000"; emp.UniversityName = "0000"; emp.UniversityMajor = "0000"; emp.GraduationYear = 0; emp.LinkedInAccount = "0000"; emp.CompanyId = compId; emp.DepartmentName = "HR"; emp.EmployeePosition = "HR Director"; emp.HiringDate = DateTime.Today; emp.EmployeeStatusId = 1; emp.Comment = "0000"; emp.EmployeeTypeId = 2; empRep.AddEmployee(emp); emp = empRep.GetEmployee(data.Email, data.Email, data.Email); Op_EmployeeLoginData eld = new Op_EmployeeLoginData(); eld.Id = emp.Id; eld.LoginEmail = emp.Email; eld.EmployeePassword = data.Password; eldRep.AddEmployeeLoginData(eld); return(RedirectToAction("index", "admin")); }
public IActionResult EditEmp(Op_Employee op_Employee) { if (op_Employee != null) { _context.Employees.Update(op_Employee); _context.SaveChanges(); return(RedirectToAction("FindEmployees", "RecruiterOperations")); } return(View()); }
public IActionResult addemp(Op_Employee Op_Employee) { if (ModelState.IsValid) { _context.Employees.Add(Op_Employee); _context.SaveChanges(); return(RedirectToAction("Login", "Account")); } return(View(Op_Employee)); }
public bool AddEmployee(Op_Employee emp) { try { db.Employees.Add(emp); db.SaveChanges(); return(true); } catch (Exception e) { Console.WriteLine(e.Message); return(false); } }
public bool EditEmployee(Op_Employee newEmp) { try { var oldData = db.Employees.Find(newEmp.Id); oldData = newEmp; db.SaveChanges(); return(true); } catch (Exception e) { Console.WriteLine(e.Message); return(false); } }