Open Closed

Modify ProfileAppService #8724

ArturCorreia created


Can you point me in the right direction on how I could connect a new table to an existing zero table in the user profile?

I think i need to modify ProfileAppService.cs and join the zero User table with my UserDetails table using LinQ.

But I need to modify the output DTO of the GetCurrentUserProfileForEdit method and return necessary information to profile edit modal. Then, I need to modify input DTO class of UpdateCurrentUserProfile method and update both User entity and my UserDetails entity in this method.

I’ve tried to figure it out but don’t think I’m on the right track can you point me exactly how I can achieve this within the 2 methods ?

I have also used my classes as a properties in your zero classes, dont know if that was the right thing to do and/or if joining the tables/classes based on ID's.

Could you show how & where I can achieve this?


4 Answer(s)
  • 0
    ismcagdas created

    Hi @ArturCorreia

    Could you share your related entity for new table ? I can write a sample query and share it with you.


  • 0
    ArturCorreia created

    Hi ismcagdas sure here you go, thank you.

    public class UserDetail : FullAuditedEntity
        public const int MaxJobTitleLength = 50;
        public const int MaxPrefersToBeCalledByNameLength = 50;
        public const int MaxTitleLength = 50;
        public const int MaxEmployeeNumberLength = 50;
        public const int MaxDepartmentLength = 50;
        public const int MaxSiteLength = 50;
        public const int MaxPhoneNumberLength = 50;
        public const int MaxMobileNumberLength = 50;
        public const int MaxLinkedInProfileURLLength = 200;
        public const int MaxTwitterProfileURLLength = 50;
        public const int MaxHobbiesLength = 100;
        public const int MaxFavouriteSportsTeamLength = 100;
        public const int MaxFavouriteBandsOrMusicsLength = 100;
        public const int MaxFavouriteArtistsOrMoviesLength = 100;
        public const int MaxMoreAboutMeLength = 4000;
        public const int MaxExternalContactCompanyNameLength = 50;
        public const int MaxExternalContactWebsiteLength = 200;
        public int UserId { get; set; }
        public string JobTitle { get; set; }
        public int LineManagerId { get; set; }
        public string PrefersToBeCalledByName { get; set; }
        public string Title { get; set; } 
        public string EmployeeNumber { get; set; }
        public DateTime DateOfBirth { get; set; }
        public string Department{ get; set; }
        public int CountryId { get; set; }
        public string Site { get; set; }
        public string PhoneNumber { get; set; }
        public string MobileNumber { get; set; }
        public string LinkedInProfileURL { get; set; }
        public string TwitterProfileURL { get; set; }
        public DateTime JoinedTheCompanyOnDate { get; set; }
        public DateTime JoinedTheDepartmentOnDate { get; set; }
        public string Hobbies { get; set; }
        public string FavouriteSportsTeam { get; set; }
        public string FavouriteBandsOrMusics { get; set; }
        public string FavouriteArtistsOrMovies { get; set; } 
        public string MoreAboutMe { get; set; }
        public bool ExternalContactFlag { get; set; }
        public string ExternalContactCompanyName { get; set; }
        public int ExternalContactTypeID { get; set; }
        public string ExternalContactWebsite { get; set; } 
  • 0
    ismcagdas created


    You can basically write something like this;

    var query = (from user in _userRepository.GetAll()
    join userDetail in _userDetailRepository.GetAll() on user.Id equals userDetail.UserId
    select new {
    	UserName = user.Username,
    	Title = userDetail.Title,
  • 0
    ArturCorreia created

    Hi ismcagdas

    Now that i have then join in place and no errors showing, what i notice now is that when running the server side app and when i execute the https://localhost:44301/api/services/app/Profile/GetCurrentUserProfileForEdit and dont seem to get all the joined data back from my own table and i do have data in both tables.

    Is there something else i'm missing like another map?