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")); }
public void Update(MemberOfGroup member) { var item = _context.MemberOfGroup.Find(member.Id); _context.Entry(item).CurrentValues.SetValues(member); Save(); }
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)); } }
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()); } }
public void Delete(MemberOfGroup member) { _context.MemberOfGroup.Remove(member); Save(); }
public void Add(MemberOfGroup member) { _context.MemberOfGroup.Add(member); Save(); }
public void AddMembership(MemberOfGroup membership) { _memberRepository.Add(membership); }