public int UpsertEmployee(EmployeeViewModal user) { user.Password = EncryptionHelper.Encrypt(user.Password); using (var db = new E2EWebPortalEntities()) { return(db.sp_UpsertEmployee(user.EmployeeID , user.UserName , user.Password , user.EmployerID , user.RoleID , user.Active , user.FirstName , user.MiddleName , user.LastName , user.NickName , user.Title , user.DateOfBirth , user.Address1 , user.Address2 , user.City , user.State , user.zip , user.WorkPhoneNumber , user.Extn , user.CellPhoneNumber , user.PrimaryEmail , user.SecondaryEmail , user.CurrentVisaStatus , user.CurrentVisaValidity)); } }
// GET: Employee public ActionResult Index() { ViewBag.Action = "Add"; EmployeeViewModal empViewModal = new EmployeeViewModal { Employees = context.Employees.ToList() }; return(View(empViewModal)); }
public ViewResult EmployeeForm() { ViewBag.Action = "Add"; EmployeeViewModal employeeVM = new EmployeeViewModal { Departments = ctx.Departments.ToList() }; return(View(employeeVM)); }
public ActionResult Update(EmployeeViewModal employeeViewModal) { var empDTO = _mapper.Map <EmployeeDTO>(employeeViewModal); if (employeeViewModal.EmployeeId == 0) { _employeeService.Create(empDTO); } else { _employeeService.Update(empDTO); } return(RedirectToAction("Index")); }
public ActionResult EmployeeEditForm(int id) { ViewBag.Action = "Edit"; Employee emp = ctx.Employees.Find(id); if (emp != null) { EmployeeViewModal employeeVM = new EmployeeViewModal { Departments = ctx.Departments.ToList(), Employee = emp }; return(View("EmployeeForm", employeeVM)); } return(HttpNotFound("Employee not found")); }
public ViewResult EmployeeForm(Employee employee) { ViewBag.Action = "Add"; if (ModelState.IsValid) { ctx.Employees.Add(employee); ctx.SaveChanges(); return(View("FormResult")); } EmployeeViewModal employeeVM = new EmployeeViewModal { Departments = ctx.Departments.ToList() }; return(View("EmployeeForm", employeeVM)); }
public ActionResult EmployeeEditForm(Employee employee) { ViewBag.Action = "Edit"; if (ModelState.IsValid) { ctx.Employees.Attach(employee); ctx.Entry(employee).State = EntityState.Modified; ctx.SaveChanges(); return(RedirectToAction(nameof(Index))); } EmployeeViewModal employeeVM = new EmployeeViewModal { Departments = ctx.Departments.ToList(), Employee = employee }; return(View("EmployeeForm", employeeVM)); }
public JsonResult SignUpEmployerAdmin(FormCollection form) { EmployeeViewModal user = new EmployeeViewModal(); user.UserName = Convert.ToString(form["UserName"].ToString()); user.Password = Convert.ToString(form["Password"].ToString()); user.EmployeeID = Convert.ToInt16(form["EmployeeID"] != "" ? form["EmployeeID"].ToString() : "0"); user.EmployerID = Convert.ToInt16(form["EmployerID"] != "" ? form["EmployerID"].ToString() : "0"); user.RoleID = Convert.ToInt16(form["RoleID"] != "" ? form["RoleID"].ToString() : "0"); user.Active = Convert.ToInt16(form["Active"] == "Yes" ? "1" : "0"); user.FirstName = Convert.ToString(form["FirstName"].ToString()); user.MiddleName = Convert.ToString(form["MiddleName"].ToString()); user.LastName = Convert.ToString(form["LastName"].ToString()); user.NickName = Convert.ToString(form["NickName"].ToString()); user.Title = Convert.ToString(form["Title"].ToString()); user.Address1 = Convert.ToString(form["Address1"].ToString()); user.Address2 = Convert.ToString(form["Address2"].ToString()); user.City = Convert.ToString(form["City"].ToString()); user.State = Convert.ToString(form["State"].ToString()); user.zip = Convert.ToString(form["zip"].ToString()); user.WorkPhoneNumber = Convert.ToString(form["WorkPhoneNumber"].ToString()); user.Extn = Convert.ToString(form["Extn"].ToString()); user.CellPhoneNumber = Convert.ToString(form["CellPhoneNumber"].ToString()); user.PrimaryEmail = Convert.ToString(form["PrimaryEmail"].ToString()); user.SecondaryEmail = Convert.ToString(form["SecondaryEmail"].ToString()); user.CurrentVisaStatus = Convert.ToString(form["CurrentVisaStatus"].ToString()); user.CurrentVisaValidity = Convert.ToString(form["CurrentVisaValidity"].ToString()); user.DateOfBirth = Convert.ToDateTime(form["DateOfBirth"] != "null" ? form["DateOfBirth"].ToString() : "1970/1/1"); var result = _userRepo.UpsertEmployee(user); if (result == -1) { TempData["ConfirmationType"] = "SignUpSuccessful"; return(Json(new { Code = 1, Message = "You are registered successfully with E2EWebPortal." })); } else { return(Json(new { Code = 0, Message = "Something wrong occured! Please try again!" })); } }