コード例 #1
0
        public void EnableUserAccess(UserAccessTable AccessTable)
        {
            try
            {
                var userName = from a in dbContext.Members
                               join b in dbContext.AspNetUsers on a.EmailAddress equals b.Email
                               join c in dbContext.UserAccessTables on b.Id equals c.UserGuidId
                               select a.MemberName;
                UserAccessTable table = new UserAccessTable
                {
                    UserGuidId   = AccessTable.UserGuidId,
                    RoleGuidId   = AccessTable.RoleGuidId,
                    DateEnrolled = DateTime.Now,
                    UserName     = "******",
                    FunctionId   = -999,
                    UserRevoked  = false
                };

                IdentityHelper.AddUserToRole(table.UserGuidId, table.RoleGuidId);

                dbContext.UserAccessTables.Add(table);
                dbContext.SaveChanges();
            }
            catch (Exception userException)
            {
                Error.InsertError(userException);
            }
        }