Ignore:
Timestamp:
10/28/25 10:51:44 (11 months ago)
Author:
GitHub <noreply@…>
Branches:
master
Children:
f8af32b
Parents:
c2e73b6 (diff), ff202cf (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Boris Gjorgjievski <69085722+imbrsk@…> (10/28/25 10:51:44)
git-committer:
GitHub <noreply@…> (10/28/25 10:51:44)
Message:

Merge pull request #6 from stefansaveski/feature/getUser

Feature/get user

Location:
iknow-api/Repository
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • iknow-api/Repository/Implementations/UserRepository.cs

    rc2e73b6 r4708118  
    2424            return await _context.User.FirstOrDefaultAsync(u => u.Email == username);
    2525        }
     26       
     27        public async Task<User?> GetUserByIdAsync(int id)
     28        {
     29            return await _context.User
     30                .Include(u => u.ContactInfo)
     31                .Include(u => u.EnrollmentInfo)
     32                .Include(u => u.HighSchool)
     33                .FirstOrDefaultAsync(u => u.Id == id);
     34        }
     35
     36
    2637        public async Task<User?> GetOnlyUserByIdAsync(int id)
    2738        {
     
    3344            await _context.SaveChangesAsync();
    3445        }
     46        public async Task AddContactAsync(ContactInfo contactInfo)
     47        {
     48            _context.ContactInfo.Add(contactInfo);
     49            await _context.SaveChangesAsync();
     50        }
     51        public async Task AddEnrollmentAsync(EnrollmentInfo enrollment)
     52        {
     53            _context.EnrollmentInfo.Add(enrollment);
     54            await _context.SaveChangesAsync();
     55        }   
     56        public async Task AddHighSchoolAsync(HighSchool highSchool)
     57        {
     58            _context.HighSchool.Add(highSchool);
     59            await _context.SaveChangesAsync();
     60        }       
    3561
    3662        public async Task<int> GetUsersCountAsync()
  • iknow-api/Repository/Interface/IUserRepository.cs

    rc2e73b6 r4708118  
    77        Task<User?> GetUserByUsernameAsync(string username);
    88        Task AddUserAsync(User user);
     9        Task AddContactAsync(ContactInfo contactInfo);
     10        Task AddEnrollmentAsync(EnrollmentInfo enrollment);
     11        Task AddHighSchoolAsync(HighSchool highSchool);
    912        Task<int> GetUsersCountAsync();
     13        Task<User> GetUserByIdAsync(int id);
    1014        Task<User?> GetOnlyUserByIdAsync(int id);
    1115
Note: See TracChangeset for help on using the changeset viewer.