public ActionResult CompetitionKind(string id)
 {
     int admin = base.Authentication();
     if (admin == 0)
     {
         return Redirect("~/member/logout");
     }
     else if (admin == 1)
     {
         base.LoadMenu();
         try
         {
             int idd = Convert.ToInt16(id);
             Kinds kindsModels = new Kinds();
             kindsModels.ID = idd;
             kindsModels = kindsModels.GetNavigationWithID("Competition");
             ViewBag.Title += " Competition have " + kindsModels.Name + " Kind";
             return View(kindsModels.Competition.ToList());
         }
         catch
         {
             Session["admin"] = null;
             return Redirect("~/");
         }
     }
     else
     {
         Session["errorContorllerAction"] = true;
         return Redirect("~/administrator");
     }
 }
        //
        // GET: /Administrator/Kinds/

        public ActionResult Index(string id)
        {
            int admin = base.Authentication();
            if (admin == 0)
            {
                return Redirect("~/member/logout");
            }
            else if (admin == 1)
            {
                base.LoadMenu();
                int currentPage = Paging.GetPage(id);
                decimal totalRecord = GlobalInfo.NumberRecordInPage;
                Kinds kindsModels = new Kinds();
                decimal totalKind = kindsModels.TotalKind();
                int totalPage = (int)Math.Ceiling(Convert.ToDecimal(totalKind / totalRecord));
                Paging.numPage = totalPage;
                Paging.numLinkDisplay = GlobalInfo.NumLinkPagingDisplay;
                Paging.currentPage = currentPage;
                string url = "administrator/kinds/index";
                ViewBag.pagingString = Paging.GenerateLinkPaging(url);
                ViewBag.Title += " Kinds";
                return View(kindsModels.ListKind((int)((currentPage - 1) * totalRecord), (int)totalRecord));
            }
            else
            {
                Session["errorContorllerAction"] = true;
                return Redirect("~/administrator");
            }
        }
 public ActionResult DesignKind(string id)
 {
     int admin = base.Authentication();
     if (admin == 0)
     {
         return Redirect("~/member/logout");
     }
     else if (admin == 1)
     {
         base.LoadMenu();
         try
         {
             int idd = Convert.ToInt16(id);
             Kinds kindsModels = new Kinds();
             kindsModels.ID = idd;
             kindsModels = kindsModels.GetNavigationWithID("Design");
             ViewBag.Title += " Designs of " + kindsModels.Name + " Competition";
             List<Designs> listDesign = kindsModels.Design.ToList();
             List<Designs> listDesignNew = new List<Designs>();
             listDesign.ForEach(delegate(Designs design)
             {
                 design = design.GetDesignByID();
                 listDesignNew.Add(design);
             });
             return View(listDesignNew);
         }
         catch
         {
             Session["admin"] = null;
             return Redirect("~/");
         }
     }
     else
     {
         Session["errorContorllerAction"] = true;
         return Redirect("~/administrator");
     }
 }
 public ActionResult Add(FormCollection form)
 {
     int admin = base.Authentication();
     if (admin == 0)
     {
         return Redirect("~/member/logout");
     }
     else if (admin == 1)
     {
         base.LoadMenu();
         var db = new FineArtContext();
         if (form["submit_kind"] != null)
         {
             StringBuilder stringBuilder = new StringBuilder();
             stringBuilder.Append("<ul>");
             Strings stringsLibs = new Strings();
             if (form["Name"].Trim() == "")
             {
                 stringBuilder.Append("<li>Please type competition name</li>");
             }
             if (form["Alias"].Trim() == "")
             {
                 stringBuilder.Append("<li>Please type competition alias</li>");
             }
             else if (!Validator.ISAlias(form["Alias"]))
             {
                 stringBuilder.Append("<li>Competition alias unvalid</li>");
             }
             if (stringBuilder.ToString() == "<ul>")
             {
                 Kinds kind = new Kinds { Name = form["Name"], Alias = form["Alias"], DateUpdate = DateTime.Now, Description = form["Description"].Trim() };
                 db.Kinds.Add(kind);
                 db.SaveChanges();
                 ViewBag.success = "Add kind success!";
             }
             else
             {
                 stringBuilder.Append("</ul>");
                 ViewBag.error = stringBuilder.ToString();
                 ViewBag.dataForm = form;
             }
         }
         return View();
     }
     else
     {
         Session["errorContorllerAction"] = true;
         return Redirect("~/administrator");
     }
 }