public void btnAddRole_Clicked(object sender, EventArgs e)
    {
        modalAddRole.Hide();
        MonkData db = new MonkData();
        Monks.aspnet_UsersInRole userInRole = new Monks.aspnet_UsersInRole();
        userInRole.RoleId = new Guid(dlRolesToAssign.SelectedValue);
        userInRole.UserId = PageUserId;

        var usersInRolesSame = from u in db.aspnet_UsersInRoles
                               where u.UserId == PageUserId && u.RoleId == userInRole.RoleId
                               select u;
        if(usersInRolesSame.Count() > 0)
            return;
        db.aspnet_UsersInRoles.InsertOnSubmit(userInRole);
        db.SubmitChanges();

        LoadPageData();
    }
Exemple #2
0
		private void detach_aspnet_UsersInRoles(aspnet_UsersInRole entity)
		{
			this.SendPropertyChanging();
			entity.aspnet_User = null;
		}
Exemple #3
0
		private void attach_aspnet_UsersInRoles(aspnet_UsersInRole entity)
		{
			this.SendPropertyChanging();
			entity.aspnet_Role = this;
		}