Ejemplo n.º 1
0
        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 bool AddEmployeeLoginData(Op_EmployeeLoginData eld)
 {
     try
     {
         db.EmployeeLoginDatas.Add(eld);
         db.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return(false);
     }
 }