public Task AddAppToUserAsync(TUser user, string appId) { if (IsUserRegisteredForApp(user, appId)) { throw new ArgumentException(string.Format("App {0} already has been added to user {1}", appId, user.Id)); } UserAppRepository.Insert(new IdentityUserApp { AppId = appId, UserId = user.Id }); return(Task.FromResult(0)); }
private IEnumerable <IdentityUserApp> GetUserApps(TUser user) { if (user == null) { throw new ArgumentNullException(nameof(user)); } var apps = UserAppRepository.GetByWhere(new Dictionary <string, object> { { "UserId", user.Id } }); return(apps); }
private IEnumerable <IdentityUserApp> GetUserAppList(TUser user, string appId) { if (user == null) { return(new List <IdentityUserApp>()); } var userList = UserAppRepository.GetByWhere(new Dictionary <string, object> { { "UserId", user.Id }, { "AppId", appId } }); return(userList); }
public IActionResult Register(UserRegister userRegister) { if (userRegister is null || !ModelState.IsValid) { return(BadRequest()); } int id = UserAppRepository.Insert(new UserApp() { Username = userRegister.Username, Email = userRegister.Email, Firstname = userRegister.Firstname, Lastname = userRegister.Lastname, DateBirth = userRegister.DateBirth, Password = userRegister.Password }); return(Ok(id)); }
public UserController(UserAppRepository userAppRepository) { UserAppRepository = userAppRepository; }
public AuthController(UserAppRepository userAppRepository, TokenManager tokenManager) { UserAppRepository = userAppRepository; TokenManager = tokenManager; }