コード例 #1
0
        public void UpdateEmployee(string name, string email, string Role, string UserId)
        {
            var employee = GetEmployee(UserId);

            if (Role == "Driver")
            {
                var driver = DriverRepository.GetById(employee.Id);
                driver.SetName(name);
                driver.SetEmail(email);
                DriverRepository.Update(driver);
            }
            else if (Role == "Supervisor")
            {
                var supervisor = SupervisorRepository.GetById(employee.Id);
                supervisor.SetEmail(email);
                supervisor.SetName(name);
                SupervisorRepository.Update(supervisor);
            }
            else if (Role == "Dispatcher")
            {
                var dispatcher = DispatcherRepository.GetById(employee.Id);
                dispatcher.SetName(name);
                dispatcher.SetEmail(email);
                DispatcherRepository.Update(dispatcher);
            }
        }
コード例 #2
0
        // GET: Supervisors/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var supervisorDetailViewModel = _mapper.Map <SupervisorDetailViewModel>(await _supervisorRepository.GetById(id));

            if (supervisorDetailViewModel == null)
            {
                return(NotFound());
            }

            return(View(supervisorDetailViewModel));
        }
コード例 #3
0
 public SupervisorVM GetSupervisors(int Id)
 {
     return(_supervisorRepository.GetById(Id));
 }
コード例 #4
0
 public Supervisor GetById(int id)
 {
     return(repo.GetById(id));
 }