public static void addUserToManageUsersTable(UserRecord user) { try { var _manageUsersRepository = new ManageUseresRepository(); var userRecord = _manageUsersRepository.SaveUser(user.userId, DateTime.Now); if (userRecord == null) { throw new Exception("Error inserting user to ManageUsers table"); } return; } catch (Exception e) { throw new AzureApiBadResponseCodeExcpetion(e); } }
/* * after signing in to the application, check if the user already in the db and add him if not * in this point we have the mshealth profile information of the user * from there we can retrieve the userId */ public static bool assertUserInDB(string UserId) { var _manageUsersRepository = new ManageUseresRepository(); try { var userRecord = _manageUsersRepository.GetUser(UserId); if (userRecord == null) { return(false); } else { return(true); } } catch (Exception e) { throw new AzureApiBadResponseCodeExcpetion(e); } }