/// <summary> /// Returns true if email is already taken. Not case sensitive /// </summary> /// <param name="context"></param> /// <param name="email"></param> /// <returns></returns> public async static Task<bool> IsEmailTaken(GameContext context, string email) { return await context.Members.Where(m => m.EmailAddress == email.Trim()).AnyAsync(); }
/// <summary> /// Adds a member to the database. Returns the member with their MemberId populated /// </summary> /// <param name="context">The database context to be used</param> /// <param name="m">The new Member to be added</param> /// <returns></returns> public async static Task<Member> Add(GameContext context, Member m) { context.Members.Add(m); await context.SaveChangesAsync(); return m; }
/// <summary> /// Returns true if username is a already taken. /// </summary> /// <param name="context"></param> /// <param name="username"></param> /// <returns></returns> public async static Task<bool> isUsernameTaken(GameContext context, string username) { return await context.Members.Where(m => m.Username == username.Trim()).AnyAsync(); }