/// <summary> /// Method to get Core User Object by User ID /// </summary> /// <param name="id"></param> /// <returns>Core User</returns> public async Task <CoreUser> GetUserById(long id) { var dbUser = await _userRepository.GetUserByUserId(id); if (dbUser == null) { throw new Exception("User does not exist"); } CoreUser coreUser = EfUserMapper.DbToCoreUser(dbUser); return(coreUser); }
/// <summary> /// Method to pull user object by email /// </summary> /// <param name="email"></param> /// <returns>Core User</returns> public async Task <CoreUser> GetUserByEmail(string email) { //pull user object var dbUser = await _userRepository.GetUserByEmail(email); //validate user exists if (dbUser == null) { throw new Exception("User does not exist"); } //map db user to core user CoreUser coreUser = EfUserMapper.DbToCoreUser(dbUser); return(coreUser); }