Пример #1
0
        public ActionResult Index(FormCollection us)
        {
            var st = us.GetKey(0);

            FC = us;
            if (st.CompareTo("Create") != 0)
            {
                var client = new MvcUniJudje.WebReference.ServiceForAdmin();
                MvcUniJudje.WebReference.GroupDTO[] GDTO = client.GetAllGroups(Session["session_key"].ToString());
                int ij = 0;
                for (int i = 0; i < GDTO.Count(); i++)
                {
                    var s = FC[(GDTO[i].Id.ToString())].Remove(2);
                    if (s.Equals("tr"))
                    {
                        ij++;
                    }
                }
                if (ij == 0)
                {
                    ModelState.AddModelError("UnSelectGroup", "Не выбраны группы.");
                }

                if (ModelState.IsValid)
                {
                    return(RedirectToAction(st));
                }
                return(View(GDTO));
            }
            return(RedirectToAction(st));
        }
Пример #2
0
 public ActionResult Delete()
 {
     using (var client = new MvcUniJudje.WebReference.ServiceForAdmin())
     {
         MvcUniJudje.WebReference.GroupDTO[] GDTO = client.GetAllGroups(Session["session_key"].ToString());
         List <int> checkBox = new List <int>();
         List <WebReference.GroupDTO> group = new List <WebReference.GroupDTO>();
         for (int i = 0; i < GDTO.Count(); i++)
         {
             var s = FC[(GDTO[i].Id.ToString())].Remove(2);
             if (s.Equals("tr"))
             {
                 checkBox.Add(GDTO[i].Id);
                 group.Add((from c in GDTO
                            where c.Id == GDTO[i].Id
                            select new WebReference.GroupDTO {
                     Id = c.Id, Title = c.Title
                 }).FirstOrDefault());
             }
         }
         return(View(group));
     }
 }