Example #1
0
        public async Task <ActionResult <string> > GetSelf()
        {
            try {
                var user = await _userManager.GetUserAsync(User);

                if (user != null)
                {
                    return(Ok(_dtoService.EmployeeToDTO(user)));
                }
            } catch (Exception exception)
            {
                //Log.Error(exception, "Failed to get role");
                return(StatusCode((int)HttpStatusCode.Unauthorized, "User ir not logged in."));
            }
            return(Unauthorized());
        }
        public async Task <ActionResult <EmployeeDTO> > GetEmployeeById(Guid id)
        {
            Employee employee = await _repository.GetById(id);

            return(_dtoService.EmployeeToDTO(employee));
        }