public ActionResult Index(FormCollection us) { var st = us.GetKey(1); FC = us; if (st.CompareTo("Create") != 0) { var client = new MvcUniJudje.WebReference.ServiceForAdmin(); MvcUniJudje.WebReference.AdminDTO[] ADTO = client.GetAdmins(Session["session_key"].ToString()); int ij = 0; for (int i = 0; i < ADTO.Count(); i++) { var s = FC[(ADTO[i].ID.ToString())].Remove(2); if (s.Equals("tr")) { ij++; } } if (ij == 0) { ModelState.AddModelError("UnSelectAdmin", "Не выбраны администраторы."); } if (ModelState.IsValid) { return(RedirectToAction(st)); } return(View(ADTO)); } return(RedirectToAction(st)); }
public ActionResult Index() { ValidationIn val = new ValidationIn(); if (val.Validation("Администраторы", Session["session_key"].ToString(), Session["name"].ToString())) { var client = new MvcUniJudje.WebReference.ServiceForAdmin(); WebReference.AdminDTO[] list = client.GetAdmins(Session["session_key"].ToString()); return(View(list)); } return(RedirectToAction("Index", "Home")); }
public ActionResult AcessOne(int id) { using (var client = new MvcUniJudje.WebReference.ServiceForAdmin()) { MvcUniJudje.WebReference.AdminDTO[] ADTO = client.GetAdmins(Session["session_key"].ToString()); List <WebReference.AdminDTO> admit = new List <WebReference.AdminDTO>(); admit.Add(((from c in ADTO where c.ID == id select new WebReference.AdminDTO { ID = c.ID, Login = c.Login, email = c.email }).FirstOrDefault())); return(View("Acess", admit)); } }
public ActionResult Acess() { using (var client = new MvcUniJudje.WebReference.ServiceForAdmin()) { MvcUniJudje.WebReference.AdminDTO[] ADTO = client.GetAdmins(Session["session_key"].ToString()); List <int> checkBox = new List <int>(); List <WebReference.AdminDTO> admit = new List <WebReference.AdminDTO>(); for (int i = 0; i < ADTO.Count(); i++) { var s = FC[(ADTO[i].ID.ToString())].Remove(2); if (s.Equals("tr")) { checkBox.Add(ADTO[i].ID); admit.Add((from c in ADTO where c.ID == ADTO[i].ID select new WebReference.AdminDTO { ID = c.ID, Login = c.Login, email = c.email }).FirstOrDefault()); } } return(View(admit)); } }