// GET: Projects/Create public ActionResult Create() { ViewBag.ContractorId = new SelectList(contractorRepo.GetAll(), "Id", "Name"); ViewBag.CustomerId = new SelectList(customerRepo.GetAll(), "Id", "Name"); ViewBag.ManagerId = new SelectList(employeeRepo.GetAll(), "Id", "FullName"); return(View()); }
public IEnumerable <Employee> GetAll() { var employees = _employeeRepo.GetAll(); PopulateAssignments(employees); return(employees); }
public void Authenticate(string email, string password) { EmployeeRepo employeeRepo = new EmployeeRepo(); List <Employee> employees = employeeRepo.GetAll(p => p.Email == email && p.Password == password).ToList(); LoggedEmployee = employees.Count > 0 ? employees[0] : null; }
public ActionResult List(string key = "") { var result = EmployeeRepo.GetAll(key); if (TempData["Error"] != null) { ViewBag.Error = TempData["Error"]; } return(View(result)); }
public ActionResult Index() { IEnumerable <EmployeeListViewModel> model = from employee in EmployeeRepo.GetAll() join department in DepartmentRepo.GetAll() on employee.DepartmentId equals department.DepartmentId select new EmployeeListViewModel() { Name = employee.FirstName + " " + employee.LastName, Department = department.DepartmentName, Phone = employee.Phone, EmployeeId = employee.EmployeeId, }; return(View(model)); }
public async Task <IActionResult> Index(string firstName, string lastName, string jobTitle, string telephone, string mobileTelephone, string email) { List <Employee> employeeList = await EmployeeRepo.GetAll(); if (!string.IsNullOrEmpty(firstName)) { employeeList = employeeList.Where(f => f.FirstName.Contains(firstName)).ToList(); } if (!string.IsNullOrEmpty(lastName)) { employeeList = employeeList.Where(l => l.LastName.Contains(lastName)).ToList(); } if (!string.IsNullOrEmpty(jobTitle)) { employeeList = employeeList.Where(j => j.JobTitle.Contains(jobTitle)).ToList(); } if (!string.IsNullOrEmpty(telephone)) { employeeList = employeeList.Where(t => t.Telephone.Contains(telephone)).ToList(); } if (!string.IsNullOrEmpty(mobileTelephone)) { employeeList = employeeList.Where(m => m.MobileTelephone.Contains(mobileTelephone)).ToList(); } if (!string.IsNullOrEmpty(email)) { employeeList = employeeList.Where(e => e.Email.Contains(email)).ToList(); } EmployeeIndexViewModel employeeIndexViewModel = new EmployeeIndexViewModel() { Employees = employeeList }; return(View(employeeIndexViewModel)); }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { var otherPropertyInfo = validationContext.ObjectType.GetProperty(this.targetProperty); var referenceProperty = (int)otherPropertyInfo.GetValue(validationContext.ObjectInstance, null); EmployeeRepo EmployeeRepo = new EmployeeRepo(); List <Employee> Employees = EmployeeRepo.GetAll().ToList(); Employee editEmployee = EmployeeRepo.GetById(referenceProperty); if (editEmployee != null) { foreach (var item in Employees) { if (item.Email == value.ToString() && editEmployee.Email != value.ToString()) { return(new ValidationResult("This E-mail already exists!")); } } } else { foreach (var item in Employees) { if (value != null) { if (item.Email == value.ToString()) { return(new ValidationResult("This E-mail already exists!")); } } } } return(base.IsValid(value, validationContext)); }
public IEnumerable <Employee> GetAll() { return(_repo.GetAll()); }
// GET: Projects/Create public ActionResult Create() { ViewBag.ProjectId = new SelectList(projectRepo.GetAll(), "Id", "Name"); ViewBag.EmployeeId = new SelectList(employeeRepo.GetAll(), "Id", "FullName"); return(View()); }
public ActionResult Index() { List <Employee> model = employees.GetAll().ToList(); return(View(model)); }
public async Task <IEnumerable <Employee> > GetEmployees() { // DataGenerator dg = new DataGenerator(_context); //await dg.Fakedata(); return(await _context.GetAll()); }