コード例 #1
0
ファイル: GroupController.cs プロジェクト: HlLiza/Diploma
        public ActionResult AddGroup(AddGroup model)
        {
            if (model == null || model.NameProject == null)
            {
                return(Json(new { status = "error", message = "Ошибка при создании группы" }));
            }

            Group gr = new Group()
            {
                Id          = Guid.NewGuid(),
                NameProject = model.NameProject,
                Direction   = model.Direction,
                HeadId      = model.SelectedHead,
                DateStart   = model.DateStart,
                DateFinish  = model.DateFinish,
            };
            MemberOfGroup membership = new MemberOfGroup()
            {
                Id      = Guid.NewGuid(),
                GroupId = gr.Id,
                UserId  = gr.HeadId
            };

            _groupService.AddGroup(gr);
            _groupService.AddMembership(membership);

            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public void Update(MemberOfGroup member)
        {
            var item = _context.MemberOfGroup.Find(member.Id);

            _context.Entry(item).CurrentValues.SetValues(member);
            Save();
        }
コード例 #3
0
        void Method10(Stream stream, IFormatter formatter)
        {
            Console.WriteLine("Method10 : Принята заявка о вступлении в группу");
            //stream.Flush();
            stream.Position = 0;
            if (stream.Length > 0)
            {
                MemberOfGroup mem = (MemberOfGroup)(formatter.Deserialize(stream));
                memeberOgGroups.Add(mem);

                Group group = null;
                foreach (Group gr in groups)
                {
                    if (gr.Id == mem.GroupID)
                    {
                        group = gr; break;
                    }
                }

                Action <Group> groupMixered = GroupMixer;
                group2.Dispatcher.Invoke(groupMixered, group);
                //usersCombo.Dispatcher.Invoke(new Action(() => { usersCombo.Items.Add(user); }));

                //Action<string> infoMesAdder = InfoMessAdd;
                //infoStack.Dispatcher.Invoke(infoMesAdder, String.Format("Пользователь {0} зарегистрировался", user.NickName));
            }
        }
コード例 #4
0
ファイル: GroupController.cs プロジェクト: HlLiza/Diploma
        public ActionResult AddMembers(string userId, string groupId)
        {
            try
            {
                MemberOfGroup membership = new MemberOfGroup()
                {
                    Id      = Guid.NewGuid(),
                    GroupId = Guid.Parse(groupId),
                    UserId  = Guid.Parse(userId)
                };
                _groupService.AddMembership(membership);

                return(RedirectToAction("OpenGroup", new { groupId = groupId }));
            }
            catch (Exception e)
            {
                ViewBag.Text = "Попробуйте еще раз";
                return(View());
            }
        }
コード例 #5
0
 public void Delete(MemberOfGroup member)
 {
     _context.MemberOfGroup.Remove(member);
     Save();
 }
コード例 #6
0
 public void Add(MemberOfGroup member)
 {
     _context.MemberOfGroup.Add(member);
     Save();
 }
コード例 #7
0
ファイル: GroupService.cs プロジェクト: HlLiza/Diploma
 public void AddMembership(MemberOfGroup membership)
 {
     _memberRepository.Add(membership);
 }