Esempio n. 1
0
        public async Task <IActionResult> GetRegion([FromRoute] long id)
        {
            _log.LogDebug($"REST request to get Region : {id}");
            var result = await _regionService.FindOne(id);

            return(ActionResultUtil.WrapOrNotFound(result));
        }
        public async Task <IActionResult> GetCategoria([FromRoute] long id)
        {
            _log.LogDebug($"REST request to get Categoria : {id}");
            var result = await _categoriaRepository.QueryHelper()
                         .GetOneAsync(categoria => categoria.Id == id);

            return(ActionResultUtil.WrapOrNotFound(result));
        }
Esempio n. 3
0
        public async Task <IActionResult> Get([FromQuery] CompanySearchModel search)
        {
            var companies = await _companiesRepository.FindManyAsync(
                new string[] { "Phones", "Address", "Email" },
                search.GetSearchExpressions());

            return(ActionResultUtil.WrapOrNotFound(companies));
        }
Esempio n. 4
0
        public async Task <IActionResult> GetDeployment([FromRoute] string id)
        {
            _log.LogDebug($"REST request to get Deployment : {id}");
            var result = await _applicationDatabaseContext.Deployments
                         .SingleOrDefaultAsync(deployment => deployment.Id.Equals(id));

            return(ActionResultUtil.WrapOrNotFound(result));
        }
Esempio n. 5
0
        public async Task <IActionResult> GetPieceOfWork([FromRoute] long id)
        {
            _log.LogDebug($"REST request to get PieceOfWork : {id}");
            var result = await _applicationDatabaseContext.PieceOfWorks
                         .SingleOrDefaultAsync(pieceOfWork => pieceOfWork.Id == id);

            return(ActionResultUtil.WrapOrNotFound(result));
        }
        public async Task <IActionResult> GetOperation([FromRoute] long id)
        {
            _log.LogDebug($"REST request to get Operation : {id}");
            var result =
                await _applicationDatabaseContext.Operations.SingleOrDefaultAsync(operation => operation.Id == id);

            return(ActionResultUtil.WrapOrNotFound(result));
        }
Esempio n. 7
0
        public async Task <IActionResult> GetProject([FromRoute] string id)
        {
            _log.LogDebug($"REST request to get Project : {id}");
            var result = await _applicationDatabaseContext.Projects
                         .SingleOrDefaultAsync(project => project.Id == id);

            return(ActionResultUtil.WrapOrNotFound(result));
        }
Esempio n. 8
0
        public async Task <IActionResult> Get([FromQuery] PersonSearchModel searchModel)
        {
            var people = await _peopleRepository.FindManyAsync(
                new string[] { "Emails", "Address", "Phones" },
                searchModel.GetSearchExpressions());

            return(ActionResultUtil.WrapOrNotFound(people));
        }
Esempio n. 9
0
        public async Task <IActionResult> GetConfig([FromRoute] string id)
        {
            _log.LogDebug($"REST request to get Config : {id}");
            var result = await _applicationDatabaseContext.Configs
                         .SingleOrDefaultAsync(config => config.Id == id);

            return(ActionResultUtil.WrapOrNotFound(result));
        }
        public async Task <IActionResult> GetContact([FromRoute] long id)
        {
            _log.LogDebug($"REST request to get Contact : {id}");
            var result = await _contactService.FindOne(id);

            ContactDto contactDto = _mapper.Map <ContactDto>(result);

            return(ActionResultUtil.WrapOrNotFound(contactDto));
        }
Esempio n. 11
0
        public async Task <IActionResult> GetRelease([FromRoute] string id)
        {
            _log.LogDebug($"REST request to get Release : {id}");
            var result = await _applicationDatabaseContext.Releases
                         .Include(r => r.Deployments)
                         .SingleOrDefaultAsync(release => release.Id == id);

            return(ActionResultUtil.WrapOrNotFound(result));
        }
Esempio n. 12
0
        public async Task <IActionResult> GetCountry([FromRoute] long id)
        {
            _log.LogDebug($"REST request to get Country : {id}");
            var result = await _applicationDatabaseContext.Countries
                         .Include(country => country.Region)
                         .SingleOrDefaultAsync(country => country.Id == id);

            return(ActionResultUtil.WrapOrNotFound(result));
        }
Esempio n. 13
0
        public async Task <IActionResult> GetDepartment([FromRoute] long id)
        {
            _log.LogDebug($"REST request to get Department : {id}");
            var result = await _departmentService.FindOne(id);

            DepartmentDto departmentDto = _mapper.Map <DepartmentDto>(result);

            return(ActionResultUtil.WrapOrNotFound(departmentDto));
        }
        public async Task <IActionResult> GetPieceOfWork([FromRoute] long id)
        {
            _log.LogDebug($"REST request to get PieceOfWork : {id}");
            var result = await _pieceOfWorkService.FindOne(id);

            PieceOfWorkDto pieceOfWorkDto = _mapper.Map <PieceOfWorkDto>(result);

            return(ActionResultUtil.WrapOrNotFound(pieceOfWorkDto));
        }
        public async Task <IActionResult> GetProduto([FromRoute] long id)
        {
            _log.LogDebug($"REST request to get Produto : {id}");
            var result = await _produtoRepository.QueryHelper()
                         .Include(produto => produto.Categoria)
                         .GetOneAsync(produto => produto.Id == id);

            return(ActionResultUtil.WrapOrNotFound(result));
        }
Esempio n. 16
0
        public async Task <IActionResult> GetJobHistory([FromRoute] long id)
        {
            _log.LogDebug($"REST request to get JobHistory : {id}");
            var result = await _jobHistoryService.FindOne(id);

            JobHistoryDto jobHistoryDto = _mapper.Map <JobHistoryDto>(result);

            return(ActionResultUtil.WrapOrNotFound(jobHistoryDto));
        }
Esempio n. 17
0
        public async Task <IActionResult> GetSemateSazeman([FromRoute] long id)
        {
            _log.LogDebug($"REST request to get SemateSazeman : {id}");
            var result = await _semateSazemanService.FindOne(id);

            SemateSazemanDto semateSazemanDto = _mapper.Map <SemateSazemanDto>(result);

            return(ActionResultUtil.WrapOrNotFound(semateSazemanDto));
        }
        public async Task <IActionResult> GetBankAccount([FromRoute] long id)
        {
            _log.LogDebug($"REST request to get BankAccount : {id}");
            var result =
                await _applicationDatabaseContext.BankAccounts.SingleOrDefaultAsync(bankAccount =>
                                                                                    bankAccount.Id == id);

            return(ActionResultUtil.WrapOrNotFound(result));
        }
        public async Task <IActionResult> GetLocation([FromRoute] long id)
        {
            _log.LogDebug($"REST request to get Location : {id}");
            var result = await _locationService.FindOne(id);

            LocationDto locationDto = _mapper.Map <LocationDto>(result);

            return(ActionResultUtil.WrapOrNotFound(locationDto));
        }
Esempio n. 20
0
        public async Task <IActionResult> GetDepartment([FromRoute] long id)
        {
            _log.LogDebug($"REST request to get Department : {id}");
            var result = await _applicationDatabaseContext.Departments
                         .Include(department => department.Location)
                         .SingleOrDefaultAsync(department => department.Id == id);

            return(ActionResultUtil.WrapOrNotFound(result));
        }
Esempio n. 21
0
        public async Task <IActionResult> GetRegion([FromRoute] long id)
        {
            _log.LogDebug($"REST request to get Region : {id}");
            var result = await _applicationDatabaseContext.Regions
                         .Include(region => region.User)
                         .SingleOrDefaultAsync(region => region.Id == id);

            return(ActionResultUtil.WrapOrNotFoundAsDto <RegionDto>(result, _mapper));
        }
Esempio n. 22
0
        public async Task <IActionResult> GetJob([FromRoute] long id)
        {
            _log.LogDebug($"REST request to get Job : {id}");
            var result = await _jobRepository.QueryHelper()
                         .Include(job => job.Tasks)
                         .Include(job => job.Employee)
                         .GetOneAsync(job => job.Id == id);

            return(ActionResultUtil.WrapOrNotFound(result));
        }
Esempio n. 23
0
        public async Task <IActionResult> GetEmployee([FromRoute] long id)
        {
            _log.LogDebug($"REST request to get Employee : {id}");
            var result = await _applicationDatabaseContext.Employees
                         .Include(employee => employee.Manager)
                         .Include(employee => employee.Department)
                         .SingleOrDefaultAsync(employee => employee.Id == id);

            return(ActionResultUtil.WrapOrNotFound(result));
        }
        public async Task <IActionResult> GetUser([FromRoute] string login)
        {
            _log.LogDebug($"REST request to get User : {login}");
            var result = await _userManager.FindByNameAsync(login);

            //TODO adopt a more idiomatic syntax with LINQ Select/Where cf. cancelation token
            var userDto = result != null ? new UserDto(result) : null;

            return(ActionResultUtil.WrapOrNotFound(userDto));
        }
Esempio n. 25
0
        public async Task <IActionResult> GetJobHistory([FromRoute] long id)
        {
            _log.LogDebug($"REST request to get JobHistory : {id}");
            var result = await _applicationDatabaseContext.JobHistories
                         .Include(jobHistory => jobHistory.Job)
                         .Include(jobHistory => jobHistory.Department)
                         .Include(jobHistory => jobHistory.Employee)
                         .SingleOrDefaultAsync(jobHistory => jobHistory.Id == id);

            return(ActionResultUtil.WrapOrNotFound(result));
        }
Esempio n. 26
0
        public async Task <IActionResult> GetJob([FromRoute] long id)
        {
            _log.LogDebug($"REST request to get Job : {id}");
            var result = await _applicationDatabaseContext.Jobs
                         .Include(job => job.JobChores)
                         .ThenInclude(jobChore => jobChore.PieceOfWork)
                         .Include(job => job.Employee)
                         .SingleOrDefaultAsync(job => job.Id == id);

            return(ActionResultUtil.WrapOrNotFound(result));
        }
Esempio n. 27
0
        public async Task <IActionResult> GetEmployee([FromRoute] long id)
        {
            _log.LogDebug($"REST request to get Employee : {id}");
            var result = await _employeeRepository.QueryHelper()
                         .Include(employee => employee.Manager)
                         .Include(employee => employee.Department)
                         .GetOneAsync(employee => employee.Id == id);

            EmployeeDto employeeDto = _mapper.Map <EmployeeDto>(result);

            return(ActionResultUtil.WrapOrNotFound(employeeDto));
        }
Esempio n. 28
0
        public async Task <IActionResult> GetOperation([FromRoute] long id)
        {
            _log.LogDebug($"REST request to get Operation : {id}");
            var result = await _applicationDatabaseContext.Operations
                         .Include(operation => operation.BankAccount)
                         .ThenInclude(bankAccount => bankAccount.User)
                         .Include(operation => operation.OperationLabels)
                         .ThenInclude(operationLabel => operationLabel.Label)
                         .SingleOrDefaultAsync(operation => operation.Id == id);

            return(ActionResultUtil.WrapOrNotFound(result));
        }
Esempio n. 29
0
        public async Task <IActionResult> GetUser([FromRoute] string login)
        {
            _log.LogDebug($"REST request to get User : {login}");
            var result = await _userManager.Users
                         .Where(user => user.Login == login)
                         .Include(it => it.UserRoles)
                         .ThenInclude(r => r.Role)
                         .SingleOrDefaultAsync();

            var userDto = result != null ? new UserDto(result) : null;

            return(ActionResultUtil.WrapOrNotFound(userDto));
        }
        public void OnException(ExceptionContext context)
        {
            if (context.HttpContext.Items.ContainsKey("ToolGood.Bedrock.QueryArgsBase"))
            {
                LogUtil.QueryArgs          = context.HttpContext.Items["ToolGood.Bedrock.QueryArgsBase"] as QueryArgs;
                ActionResultUtil.QueryArgs = LogUtil.QueryArgs;
            }
            LogUtil.Error(context.Exception);

            if (context.HttpContext.Request.Method.ToLower() == "post")
            {
                context.Result = ActionResultUtil.Error("系统出了个小差!");
            }
        }