public async Task <IActionResult> GetInfo() { var employee = await _currentUserInfo.GetCurrentEmployee(); if (employee == null) { return(Unauthorized()); } return(Ok(new OutputEmployee(employee))); }
public async Task <IActionResult> ListCurrentPhotoshoots() { var employee = await _currentUser.GetCurrentEmployee(); if (employee == null) { return(Unauthorized()); } var shoots = await _context.PhotoShoots .Include(shot => shot.Images) .Where( shoot => shoot.Employees.Any(e => e.UserId == employee.UserId)) .ToListAsync(); return(Ok(shoots.Select(s => new OutputPhotoShoot(s, true)))); }
public async Task <IActionResult> Greet(CancellationToken token = default) { var employee = await _currentUserInfo.GetCurrentEmployee(token); if (employee != null) { return(Ok(_outputHandler.OutputFor(employee))); } var user = await _currentUserInfo.GetCurrentUser(token); if (user != null) { return(Ok(_outputHandler.OutputFor(user))); } return(Unauthorized()); }