Beispiel #1
0
        public IEnumerable <Employee> GetMany(IRequestContext context)
        {
            var officeId      = context.UriParameters.GetByName <int>("OfficeID").EnsureValue();
            var linkParameter = new EmployeeLinkParameter(officeId);

            context.LinkParameters.Set(linkParameter);

            return(_employeeService.GetAll(officeId)
                   .Select(_toResourceMapper.Map));
        }
Beispiel #2
0
        public async Task <Employee> GetAsync(int id, IRequestContext context, CancellationToken cancellation)
        {
            var officeId      = context.UriParameters.GetByName <int>("OfficeID").EnsureValue();
            var linkParameter = new EmployeeLinkParameter(officeId);

            context.LinkParameters.Set(linkParameter);

            return
                (_toResourceMapper.Map(
                     await _employeeService.GetEmployeeById(id, officeId)));
        }