コード例 #1
0
        private void AddDefaultUser()
        {
            var a = context.UsersModel.ToList();

            foreach (var item in a)
            {
                if (item.Email.Equals("*****@*****.**"))
                {
                    return;
                }
            }
            users.Id       = Guid.NewGuid();
            users.Name     = "admin";
            users.Email    = "*****@*****.**";
            users.Password = "******";
            context.Add(users);
            context.SaveChanges();
        }
コード例 #2
0
        private void deletebutton_Click(object sender, RoutedEventArgs e)
        {
            group.Name = context.GroupModel.SingleOrDefault(x => x.Id == guidid).Name;
            group.Id   = context.GroupModel.SingleOrDefault(x => x.Id == guidid).Id;
            var test2 = GroupUsersListBox.SelectedItem.ToString();

            for (int i = 0; i < test.Count; i++)
            {
                if (test[i].Equals(test2))
                {
                    test.RemoveAt(i);
                }
            }
            foreach (var item in test)
            {
                group.users += item + ",";
                lol.Add(item);
            }
            usun(guidid);
            context.Add(group);
            saveasync();
            GroupUsersListBox.ItemsSource = lol;
        }