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)); }
public async Task <IActionResult> Get([FromQuery] CompanySearchModel search) { var companies = await _companiesRepository.FindManyAsync( new string[] { "Phones", "Address", "Email" }, search.GetSearchExpressions()); return(ActionResultUtil.WrapOrNotFound(companies)); }
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)); }
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)); }
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)); }
public async Task <IActionResult> Get([FromQuery] PersonSearchModel searchModel) { var people = await _peopleRepository.FindManyAsync( new string[] { "Emails", "Address", "Phones" }, searchModel.GetSearchExpressions()); return(ActionResultUtil.WrapOrNotFound(people)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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> 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)); }
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)); }
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> 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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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 async Task <IActionResult> UpdateUser([FromBody] UserDto userDto) { _log.LogDebug($"REST request to update User : {userDto}"); var existingUser = await _userManager.FindByEmailAsync(userDto.Email); if (existingUser != null && !existingUser.Id.Equals(userDto.Id)) { throw new EmailAlreadyUsedException(); } existingUser = await _userManager.FindByNameAsync(userDto.Login); if (existingUser != null && !existingUser.Id.Equals(userDto.Id)) { throw new LoginAlreadyUsedException(); } var updatedUser = await _userService.UpdateUser(userDto); return(ActionResultUtil.WrapOrNotFound(updatedUser) .WithHeaders(HeaderUtil.CreateAlert("userManagement.updated", userDto.Login))); }
public async Task <IActionResult> GetCompany(int id) { var company = await _companiesRepository.FindByIdAsync(id, "Phones", "Address", "Email"); return(ActionResultUtil.WrapOrNotFound(company)); }