public ActionResult Edit(MvcUniJudje.WebReference.GroupDTO group, FormCollection fc)
        {
            if (group.Title == null)
            {
                ModelState.AddModelError("Create", "Введите назание группы.");
            }
            if (ModelState.IsValid)
            {
                using (var client = new WebReference.ServiceForAdmin())
                {
                    MvcUniJudje.WebReference.UserDTO[] GDTO    = client.GetAllUserInGroup(Session["session_key"].ToString(), group.Id, true);
                    MvcUniJudje.WebReference.UserDTO[] GDTOout = client.GetAllUserOutGroup(Session["session_key"].ToString(), group.Id, true);
                    for (int i = 0; i < GDTO.Count(); i++)
                    {
                        var s = fc[(GDTO[i].Id.ToString())].Remove(2);
                        if (s.Equals("tr"))
                        {
                            client.DeleteOutFromGroup(Session["session_key"].ToString(), group.Id, true, GDTO[i].Id, true);
                        }
                    }
                    for (int i = 0; i < GDTOout.Count(); i++)
                    {
                        var s = fc[(GDTOout[i].Id.ToString())].Remove(2);
                        if (s.Equals("tr"))
                        {
                            client.AddInGroup(Session["session_key"].ToString(), group.Id, true, GDTOout[i].Id, true);
                        }
                    }

                    client.WebUpdateGroup(Session["session_key"].ToString(), group.Title, group.Id, true);
                }
                return(RedirectToAction("Index"));
            }
            return(View(group));
        }
 public ActionResult Create(MvcUniJudje.WebReference.GroupDTO group)
 {
     if (group.Title == null)
     {
         ModelState.AddModelError("LoginAdmin", "Введите название группы.");
     }
     if (ModelState.IsValid)
     {
         using (var client = new MvcUniJudje.WebReference.ServiceForAdmin())
         {
             try
             {
                 group.Id = client.CreateGroup(Session["session_key"].ToString()).Id;
                 client.WebUpdateGroup(Session["session_key"].ToString(), group.Title, group.Id, true);
             }
             catch (Exception ex)
             {
                 ModelState.AddModelError("Create", ex.Message);
             }
             return(RedirectToAction("Index"));
         }
     }
     return(View(group));
 }