public async Task <IHttpActionResult> GetUserByName(string username)
        {
            var user = await UserManager.FindByNameAsync(username);

            if (user != null)
            {
                return(Ok(ResponseDto <UserDto> .Create(user, UserDto.CreateFromModel)));
            }

            return(Ok(ResponseDto <UserDto> .NotFound()));
        }
        public async Task <IHttpActionResult> GetUserPictureByName(string username)
        {
            var user = await UserManager.FindByNameAsync(username);

            if (user != null)
            {
                return(Ok(ResponseDto <string> .Create(user.UserProfile.PhotoUrl)));
            }

            return(Ok(ResponseDto <UserDto> .NotFound()));
        }
        public async Task <IHttpActionResult> GetDepartmentByCode(string code)
        {
            var codeLower  = code.ToLower();
            var department = await DepartmentsService.Instance.Query().FirstOrDefaultAsync(x => x.DepartmentCode.ToLower() == codeLower);

            if (department != null)
            {
                return(Ok(ResponseDto <DepartmentDto> .Create(department.ToExtended(true), DepartmentDto.CreateFromModel)));
            }

            return(Ok(ResponseDto <DepartmentDto> .NotFound()));
        }
        public async Task <IHttpActionResult> GetTotalDepartments([FromUri] DepartmentFilterBindingModel filter)
        {
            var count = await DepartmentsService.Instance.Query().FilteredCountAsync(filter);

            return(Ok(ResponseDto <int> .Create(count)));
        }
        public async Task <IHttpActionResult> GetTotalUsers([FromUri] UserFilterBindingModel filter)
        {
            var count = await UserManager.Users.FilteredCountAsync(filter);

            return(Ok(ResponseDto <int> .Create(count)));
        }