public ActionResult Add(FormCollection form, HttpPostedFileBase Images)
        {
            int admin = base.Authentication();
            if (admin == 0)
            {
                return Redirect("~/member/logout");
            }
            else if (admin == 1)
            {
                base.LoadMenu();
                var db = new FineArtContext();
                ViewBag.listStaff = db.Members.Where(m => m.Role.ID == 3).ToList();
                ViewBag.listCOndition = db.Conditions.ToList();
                ViewBag.listAward = db.Awards.ToList();
                ViewBag.listKind = db.Kinds.ToList();
                if (form["submit_competition"] != 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() == "" || !Validator.ISAlias(form["Alias"]))
                    {
                        stringBuilder.Append("<li>Please type competition alias</li>");
                    }
                    else
                    {
                        try
                        {
                            string alias = form["Alias"].Trim().ToString();
                            var competition = db.Competitions.Where(c => c.Alias == alias).First();
                            stringBuilder.Append("<li>This competition alias had been exists in database, try a different</li>");
                        }
                        catch { }
                    }
                    int[] IDStaffs = stringsLibs.ListID(form["Staffs"]);
                    int[] IDConditions = stringsLibs.ListID(form["Conditions"]);
                    int[] IDAwards = stringsLibs.ListID(form["Awards"]);
                    int[] IDKinds = stringsLibs.ListID(form["Kinds"]);
                    ViewBag.IDStaffs = IDStaffs;
                    ViewBag.IDConditions = IDConditions;
                    ViewBag.IDAwards = IDAwards;
                    ViewBag.IDKinds = IDKinds;
                    ICollection<Members> listStaffs = db.Members.Where(s => IDStaffs.Contains(s.ID)).ToList();
                    ICollection<Conditions> listConditions = db.Conditions.Where(c => IDConditions.Contains(c.ID)).ToList();
                    List<Awards> listAwards = db.Awards.Where(a => IDAwards.Contains(a.ID)).ToList();
                    ICollection<Kinds> listKinds = db.Kinds.Where(k => IDKinds.Contains(k.ID)).ToList();
                    if (listStaffs.Count == 0)
                    {
                        stringBuilder.Append("<li>Please chose teachers scoring for this competition</li>");
                    }
                    if (listConditions.Count == 0)
                    {
                        stringBuilder.Append("<li>Please chose conditions for this competition</li>");
                    }
                    if (listAwards.Count == 0)
                    {
                        stringBuilder.Append("<li>Please chose awards for this competition</li>");
                    }
                    else
                    {
                        int j = listAwards.Count;
                        int i = 0;
                        int[] Levels = new int[j];
                        for (i = 0; i < j; i++)
                        {
                            Levels[i] = listAwards[i].Level;
                        }
                        for (i = 1; i <= j; i++)
                        {
                            if (!Levels.Contains(i))
                            {
                                stringBuilder.Append("<li>Please choose award for competition. Level of awards not duplicate</li>");
                                break;
                            }
                        }
                    }
                    if (listKinds.Count == 0)
                    {
                        stringBuilder.Append("<li>Please chose kinds for this competition</li>");
                    }
                    DateTime StartDate = new DateTime();
                    DateTime DeadlineDate = new DateTime();
                    DateTime EndDate = new DateTime();
                    try
                    {
                        StartDate = DateTime.Parse(form["StartDate"]);
                    }
                    catch
                    {
                        stringBuilder.Append("<li>Please type competition start date</li>");
                    }
                    try
                    {
                        DeadlineDate = DateTime.Parse(form["DeadlineDate"]);
                    }
                    catch
                    {
                        stringBuilder.Append("<li>Please type competition deadline date</li>");
                    }
                    try
                    {
                        EndDate = DateTime.Parse(form["EndDate"]);
                    }
                    catch
                    {
                        stringBuilder.Append("<li>Please type competition end date</li>");
                    }
                    try
                    {
                        if (DateTime.Parse(form["DeadlineDate"]) <= DateTime.Parse(form["StartDate"]))
                        {
                            stringBuilder.Append("<li>Deadline date should after start date</li>");
                        }
                    }
                    catch
                    {

                    }
                    try
                    {
                        if (DateTime.Parse(form["EndDate"]) <= DateTime.Parse(form["DeadlineDate"]))
                        {
                            stringBuilder.Append("<li>End date should after deadline date</li>");
                        }
                    }
                    catch
                    {

                    }

                    if (Images == null)
                    {
                        stringBuilder.Append("<li>Please chose a image for this competition</li>");
                    }
                    if (stringBuilder.ToString() == "<ul>")
                    {
                        ImagesClass objImageClass = new ImagesClass(Images);
                        string fileSaveName = Server.MapPath("~/Content/Images/competitions/" + form["Alias"] + ".jpg");
                        objImageClass.CreateNewImage(fileSaveName, 190, 190);
                        Competitions competitionsModels = new Competitions
                        {
                            Name = form["Name"],
                            Alias = form["Alias"],
                            Images = form["Alias"] + ".jpg",
                            Staffs = listStaffs,
                            Condition = listConditions,
                            Award = listAwards,
                            Kind = listKinds,
                            StartDate = StartDate,
                            DeadlineDate = DeadlineDate,
                            EndDate = EndDate,
                            Summary = form["Summary"].Trim()
                        };
                        db.Competitions.Add(competitionsModels);
                        db.SaveChanges();
                        ViewBag.success = "Add competition success!";
                    }
                    else
                    {
                        stringBuilder.Append("</ul>");
                        ViewBag.error = stringBuilder.ToString();
                        ViewBag.dataForm = form;
                    }
                }
                return View();
            }
            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();
                ViewBag.listMenu = db.Menus.ToList();
                if (form["submit_role"] != null)
                {
                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.Append("<ul>");
                    Strings stringsLibs = new Strings();
                    if (form["Name"].Trim() == "")
                    {
                        stringBuilder.Append("<li>Please type role name</li>");
                    }
                    if (form["Alias"].Trim() == "" || !Validator.ISAlias(form["Alias"]))
                    {
                        stringBuilder.Append("<li>Please type role alias</li>");
                    }
                    else
                    {
                        try
                        {
                            string alias = form["Alias"].Trim().ToString();
                            var role = db.Roles.Where(c => c.Alias == alias).First();
                            stringBuilder.Append("<li>This role alias had been exists in database, try a different</li>");
                        }
                        catch { }
                    }
                    int[] IDMenus = stringsLibs.ListID(form["Menus"]);
                    ViewBag.IDMenus = IDMenus;
                    ICollection<Menus> listMenus = db.Menus.Where(s => IDMenus.Contains(s.ID)).ToList();
                    if (stringBuilder.ToString() == "<ul>")
                    {
                        Roles roles = new Roles
                        {
                            Name = form["Name"].Trim(),
                            Alias = form["Alias"].Trim(),
                            Description = form["Description"].Trim(),
                            Menu = listMenus
                        };
                        db.Roles.Add(roles);
                        db.SaveChanges();
                        ViewBag.success = "Add role success!";
                    }
                    else
                    {
                        stringBuilder.Append("</ul>");
                        ViewBag.error = stringBuilder.ToString();
                        ViewBag.dataForm = form;
                    }
                }

                return View();
            }
            else
            {
                Session["errorContorllerAction"] = true;
                return Redirect("~/administrator");
            }
        }
        public ActionResult Edit(string id, FormCollection form, HttpPostedFileBase Images)
        {
            int admin = base.Authentication();
            if (admin == 0)
            {
                return Redirect("~/member/logout");
            }
            else if (admin == 1)
            {
                base.LoadMenu();
                try
                {
                    int idd = Convert.ToInt16(id);
                    var db = new FineArtContext();
                    ICollection<Members> listStaffs;
                    ICollection<Conditions> listConditions;
                    List<Awards> listAwards;
                    ICollection<Kinds> listKinds;
                    int[] IDStaffs;
                    int[] IDConditions;
                    int[] IDAwards;
                    int[] IDKinds;

                    Competitions competiton = db.Competitions.Include("Staffs").Include("Condition").Include("Award").Include("Kind").Where(c => c.ID == idd && c.DeadlineDate > DateTime.Now).FirstOrDefault();
                    if (competiton == null)
                    {
                        Session["error"] = "This competition has finished.";
                        return Redirect("~/administrator/competitions/");
                    }
                    ViewBag.listStaff = db.Members.Where(m => m.Role.ID == 3).ToList();
                    ViewBag.listCOndition = db.Conditions.ToList();
                    ViewBag.listAward = db.Awards.ToList();
                    ViewBag.listKind = db.Kinds.ToList();
                    if (form["submit_competition"] == null)
                    {
                        form["Name"] = competiton.Name;
                        form["Alias"] = competiton.Alias;
                        form["StartDate"] = competiton.StartDate.ToString("dd/MM/yyyy");
                        form["DeadlineDate"] = competiton.DeadlineDate.ToString("dd/MM/yyyy"); ;
                        form["EndDate"] = competiton.EndDate.ToString("dd/MM/yyyy");
                        form["Summary"] = competiton.Summary;
                        ViewBag.dataForm = form;

                        listStaffs = competiton.Staffs;
                        listConditions = competiton.Condition;
                        listAwards = competiton.Award.ToList();
                        listKinds = competiton.Kind;
                        IDStaffs = new int[listStaffs.Count];
                        IDConditions = new int[listConditions.Count];
                        IDAwards = new int[listAwards.Count];
                        IDKinds = new int[listKinds.Count];
                        int i = 0;
                        foreach (Members member in listStaffs)
                        {
                            IDStaffs[i] = member.ID;
                            i++;
                        }
                        i = 0;
                        foreach (Conditions condition in listConditions)
                        {
                            IDConditions[i] = condition.ID;
                            i++;
                        }
                        i = 0;
                        foreach (Awards award in listAwards)
                        {
                            IDAwards[i] = award.ID;
                            i++;
                        }
                        i = 0;
                        foreach (Kinds kind in listKinds)
                        {
                            IDKinds[i] = kind.ID;
                            i++;
                        }

                        ViewBag.IDStaffs = IDStaffs;
                        ViewBag.IDConditions = IDConditions;
                        ViewBag.IDAwards = IDAwards;
                        ViewBag.IDKinds = IDKinds;
                    }
                    else
                    {
                        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 (form["Alias"].Trim() != competiton.Alias)
                            {
                                try
                                {
                                    string alias = form["Alias"].Trim().ToString();
                                    var competition = db.Competitions.Where(c => c.Alias == alias).First();
                                    stringBuilder.Append("<li>This competition alias had been exists in database, try a different</li>");
                                }
                                catch { }
                            }
                        }
                        IDStaffs = stringsLibs.ListID(form["Staffs"]);
                        IDConditions = stringsLibs.ListID(form["Conditions"]);
                        IDAwards = stringsLibs.ListID(form["Awards"]);
                        IDKinds = stringsLibs.ListID(form["Kinds"]);
                        ViewBag.IDStaffs = IDStaffs;
                        ViewBag.IDConditions = IDConditions;
                        ViewBag.IDAwards = IDAwards;
                        ViewBag.IDKinds = IDKinds;
                        listStaffs = db.Members.Where(s => IDStaffs.Contains(s.ID)).ToList();
                        listConditions = db.Conditions.Where(c => IDConditions.Contains(c.ID)).ToList();
                        listAwards = db.Awards.Where(a => IDAwards.Contains(a.ID)).ToList();
                        listKinds = db.Kinds.Where(k => IDKinds.Contains(k.ID)).ToList();
                        if (listStaffs.Count == 0)
                        {
                            stringBuilder.Append("<li>Please chose teachers scoring for this competition</li>");
                        }
                        if (listConditions.Count == 0)
                        {
                            stringBuilder.Append("<li>Please chose conditions for this competition</li>");
                        }
                        if (listAwards.Count == 0)
                        {
                            stringBuilder.Append("<li>Please chose awards for this competition</li>");
                        }
                        else
                        {
                            int j = listAwards.Count;
                            int i = 0;
                            int[] Levels = new int[j];
                            for (i = 0; i < j; i++)
                            {
                                Levels[i] = listAwards[i].Level;
                            }
                            for (i = 1; i <= j; i++)
                            {
                                if (!Levels.Contains(i))
                                {
                                    stringBuilder.Append("<li>Please choose award for competition. Level of awards not duplicate</li>");
                                    break;
                                }
                            }
                        }
                        if (listKinds.Count == 0)
                        {
                            stringBuilder.Append("<li>Please chose kinds for this competition</li>");
                        }
                        DateTime StartDate = new DateTime();
                        DateTime DeadlineDate = new DateTime();
                        DateTime EndDate = new DateTime();
                        try
                        {
                            StartDate = DateTime.Parse(form["StartDate"]);
                        }
                        catch
                        {
                            stringBuilder.Append("<li>Please type competition start date</li>");
                        }
                        try
                        {
                            DeadlineDate = DateTime.Parse(form["DeadlineDate"]);
                        }
                        catch
                        {
                            stringBuilder.Append("<li>Please type competition deadline date</li>");
                        }
                        try
                        {
                            EndDate = DateTime.Parse(form["EndDate"]);
                        }
                        catch
                        {
                            stringBuilder.Append("<li>Please type competition deadline date</li>");
                        }
                        try
                        {
                            if (DateTime.Parse(form["DeadlineDate"]) <= DateTime.Parse(form["StartDate"]))
                            {
                                stringBuilder.Append("<li>Deadline date should after start date</li>");
                            }
                        }
                        catch
                        {

                        }
                        try
                        {
                            if (DateTime.Parse(form["EndDate"]) <= DateTime.Parse(form["DeadlineDate"]))
                            {
                                stringBuilder.Append("<li>End date should after deadline date</li>");
                            }
                        }
                        catch
                        {

                        }

                        if (stringBuilder.ToString() == "<ul>")
                        {
                            if (Images != null)
                            {
                                string fileOldName = Server.MapPath("~/Content/Images/competitions/" + competiton.Images);
                                FilesClass.DeleteFile(fileOldName);
                                ImagesClass objImageClass = new ImagesClass(Images);
                                string fileSaveName = Server.MapPath("~/Content/Images/competitions/" + form["Alias"] + ".jpg");
                                objImageClass.CreateNewImage(fileSaveName, 190, 190);
                            }
                            else
                            {
                                if (form["Alias"].Trim() != competiton.Alias)
                                {
                                    string fileOldName = Server.MapPath("~/Content/Images/competitions/" + competiton.Alias + ".jpg");
                                    string fileNewName = Server.MapPath("~/Content/Images/competitions/" + form["Alias"] + ".jpg");
                                    FilesClass.RenameFile(fileOldName, fileNewName);
                                }
                            }
                            Competitions competitonsModels;
                            competitonsModels = db.Competitions.Where(c => c.ID == idd).FirstOrDefault();
                            competitonsModels.Name = form["Name"];
                            competitonsModels.Alias = form["Alias"];
                            competitonsModels.Images = form["Alias"] + ".jpg";
                            competitonsModels.StartDate = StartDate;
                            competitonsModels.DeadlineDate = DeadlineDate;
                            competitonsModels.EndDate = EndDate;
                            competitonsModels.Staffs = listStaffs;
                            competitonsModels.Condition = listConditions;
                            competitonsModels.Award = listAwards;
                            competitonsModels.Kind = listKinds;
                            competitonsModels.Summary = form["Summary"].Trim();
                            ViewBag.dataForm = form;
                            ViewBag.success = "Update competition success!";
                            db.SaveChanges();
                        }
                        else
                        {
                            stringBuilder.Append("</ul>");
                            ViewBag.error = stringBuilder.ToString();
                            ViewBag.dataForm = form;
                        }
                    }

                    return View();
                }
                catch
                {
                    Session["admin"] = null;
                    return Redirect("~/");
                }
            }
            else
            {
                Session["errorContorllerAction"] = true;
                return Redirect("~/administrator");
            }
        }
        public ActionResult Edit(string id, FormCollection form)
        {
            int admin = base.Authentication();
            if (admin == 0)
            {
                return Redirect("~/member/logout");
            }
            else if (admin == 1)
            {
                base.LoadMenu();
                try
                {
                    int idd = Convert.ToInt16(id);
                    var db = new FineArtContext();
                    var listMenu = db.Menus.ToList();
                    ViewBag.listMenu = listMenu;
                    Roles role = db.Roles.Include("Menu").Where(r => r.ID == idd).First();
                    ICollection<Menus> listMenus;
                    int[] IDMenus;
                    if (form["submit_role"] == null)
                    {
                        form["Name"] = role.Name;
                        form["Alias"] = role.Alias;
                        form["Description"] = role.Description;
                        ViewBag.dataForm = form;
                        listMenus = role.Menu;
                        IDMenus = new int[listMenus.Count];
                        int i = 0;
                        foreach (Menus menu in listMenus)
                        {
                            IDMenus[i] = menu.ID;
                            i++;
                        }
                        ViewBag.IDMenus = IDMenus;
                    }
                    else
                    {
                        StringBuilder stringBuilder = new StringBuilder();
                        stringBuilder.Append("<ul>");
                        Strings stringsLibs = new Strings();
                        if (form["Name"].Trim() == "")
                        {
                            stringBuilder.Append("<li>Please type role name</li>");
                        }
                        if (form["Alias"].Trim() == "" || !Validator.ISAlias(form["Alias"]))
                        {
                            stringBuilder.Append("<li>Please type role alias</li>");
                        }
                        else
                        {
                            string alias = form["Alias"].Trim().ToString();
                            if (alias != role.Alias)
                            {
                                try
                                {
                                    role = db.Roles.Where(c => c.Alias == alias).First();
                                    stringBuilder.Append("<li>This role alias had been exists in database, try a different</li>");
                                }
                                catch { }
                            }
                        }
                        if (role.ID != 1)
                        {
                            IDMenus = stringsLibs.ListID(form["Menus"]);
                            listMenus = db.Menus.Where(s => IDMenus.Contains(s.ID)).ToList();
                            ViewBag.IDMenus = IDMenus;
                        }
                        else
                        {
                            listMenus = listMenu;
                            IDMenus = new int[listMenus.Count];
                            int i = 0;
                            foreach (Menus menu in listMenus)
                            {
                                IDMenus[i] = menu.ID;
                                i++;
                            }
                            ViewBag.IDMenus = IDMenus;
                        }
                        if (stringBuilder.ToString() == "<ul>")
                        {
                            role = db.Roles.Where(r => r.ID == idd).First();
                            role.Name = form["Name"].Trim();
                            role.Alias = form["Alias"].Trim();
                            role.Description = form["Description"].Trim();
                            role.Menu = listMenus;
                            db.SaveChanges();
                        }
                        else
                        {
                            stringBuilder.Append("</ul>");
                            ViewBag.error = stringBuilder.ToString();
                            ViewBag.dataForm = form;
                        }
                    }
                }
                catch
                {

                }
                return View();
            }
            else
            {
                Session["errorContorllerAction"] = true;
                return Redirect("~/administrator");
            }
        }
 public ActionResult AddDesignExhibition(string id, string param, FormCollection form)
 {
     int admin = base.Authentication();
     if (admin == 0)
     {
         return Redirect("~/member/logout");
     }
     else if (admin == 1)
     {
         base.LoadMenu();
         try
         {
             int idd = Convert.ToInt16(id);
             ViewBag.exhibitionID = idd;
             var db = new FineArtContext();
             var exhibition = db.Exhibitions.Include("Designs").Where(e => e.ID == idd && e.EndDate > DateTime.Now).FirstOrDefault();
             if (exhibition == null)
             {
                 Session["error"] = "This exhibition had ended.";
                 return Redirect("~/administrator/designs/designexhibition/" + idd);
             }
             else
             {
                 if (form["submit_design_exhibition"] == null)
                 {
                     int currentPage = Paging.GetPage(param);
                     decimal totalRecord = GlobalInfo.NumberRecordInPage;
                     var designs = db.Designs
                         .Include("Member")
                         .Include("Kind")
                         .Include("Competition").ToList();
                     designs = designs.Except(exhibition.Designs).ToList();
                     decimal totalDesign = designs.Count;
                     int totalPage = (int)Math.Ceiling(Convert.ToDecimal(totalDesign / totalRecord));
                     Paging.numPage = totalPage;
                     Paging.numLinkDisplay = GlobalInfo.NumLinkPagingDisplay;
                     Paging.currentPage = currentPage;
                     string url = "administrator/designs/adddesignexhibition/" + idd;
                     ViewBag.pagingString = Paging.GenerateLinkPaging(url);
                     ViewBag.Title += " Add design to exhibition";
                     var listDesigns = designs
                         .OrderBy(d => d.ID).Skip((int)((currentPage - 1) * totalRecord)).Take((int)totalRecord).ToList();
                     return View(listDesigns);
                 }
                 else
                 {
                     Strings stringModels = new Strings();
                     int[] IDDesigns = stringModels.ListID(form["Design"]);
                     var designs = db.Designs.Where(d => IDDesigns.Contains(d.ID)).ToList();
                     designs.ForEach(delegate(Designs design)
                     {
                         exhibition.Designs.Add(design);
                     });
                     db.SaveChanges();
                     return Redirect("~/administrator/designs/adddesignexhibition/" + idd);
                 }
             }
         }
         catch
         {
             Response.Write("OKOKO");
             return null;
         }
     }
     else
     {
         Session["errorContorllerAction"] = true;
         return Redirect("~/administrator");
     }
 }
 public ActionResult AddKindCompetition(string id, FormCollection form)
 {
     int admin = base.Authentication();
     if (admin == 0)
     {
         return Redirect("~/member/logout");
     }
     else if (admin == 1)
     {
         base.LoadMenu();
         try
         {
             int idd = Convert.ToInt16(id);
             var db = new FineArtContext();
             ViewBag.competitionID = idd;
             var competition = db.Competitions.Include("Kind").Where(c => c.ID == idd && c.DeadlineDate > DateTime.Now).FirstOrDefault();
             if (competition == null)
             {
                 Session["error"] = "This competition has finished!";
                 return Redirect("~/administrator/kinds/kindcompetition/" + idd);
             }
             else
             {
                 if (form["submit_kind"] == null)
                 {
                     if (competition == null)
                     {
                         Session["error"] = "This competition had ended.";
                         return Redirect("~/administrator/kinds/kindcompetition/" + idd);
                     }
                     else
                     {
                         var listKind = competition.Kind.ToList();
                         var listKindOther = db.Kinds.ToList();
                         listKindOther = listKindOther.Except(listKind).ToList();
                         ViewBag.listKinds = listKindOther;
                         return View();
                     }
                 }
                 else
                 {
                     Strings stringModels = new Strings();
                     int[] IDKinds = stringModels.ListID(form["Kinds"]);
                     List<Kinds> listKinds = db.Kinds.Where(k => IDKinds.Contains(k.ID)).ToList();
                     listKinds.ForEach(delegate(Kinds kind)
                     {
                         competition.Kind.Add(kind);
                     });
                     db.SaveChanges();
                     return Redirect("~/administrator/kinds/addkindcompetition/" + idd);
                 }
             }
         }
         catch
         {
             return null;
         }
     }
     else
     {
         Session["errorContorllerAction"] = true;
         return Redirect("~/administrator");
     }
 }
 public ActionResult AddExhibitionDesign(string id, FormCollection form)
 {
     int admin = base.Authentication();
     if (admin == 0)
     {
         return Redirect("~/member/logout");
     }
     else if (admin == 1)
     {
         base.LoadMenu();
         try
         {
             var db = new FineArtContext();
             int idd = Convert.ToInt16(id);
             ViewBag.exhibitionID = idd;
             var design = db.Designs.Include("Exhibitions").Where(d => d.ID == idd).First();
             var listExhibitions = db.Exhibitions
                 .Where(e => e.EndDate > DateTime.Now)
                 .ToList();
             ViewBag.listExhibitions = listExhibitions.Except(design.Exhibitions).ToList();
             if (form["submit_exhibition"] != null)
             {
                 Strings stringModels = new Strings();
                 int[] IDExhibitions = stringModels.ListID(form["Exhibitions"]);
                 ViewBag.IDExhibitions = IDExhibitions;
                 ICollection<Exhibitions> listExhibitionsOther = db.Exhibitions.Where(s => IDExhibitions.Contains(s.ID)).ToList();
                 foreach (Exhibitions ex in listExhibitionsOther)
                 {
                     design.Exhibitions.Add(ex);
                 }
                 db.SaveChanges();
                 return Redirect("~/administrator/exhibitions/addexhibitiondesign/" + idd);
             }
             else
             {
                 return View();
             }
         }
         catch
         {
             return null;
         }
     }
     else
     {
         Session["errorContorllerAction"] = true;
         return Redirect("~/administrator");
     }
 }
 public ActionResult AddMenuRole(string id, FormCollection form)
 {
     int admin = base.Authentication();
     if (admin == 0)
     {
         return Redirect("~/member/logout");
     }
     else if (admin == 1)
     {
         base.LoadMenu();
         try
         {
             var db = new FineArtContext();
             int roleID = Convert.ToInt16(id);
             var role = db.Roles.Include("Menu").Where(r => r.ID == roleID).First();
             var listMenus = db.Menus.ToList();
             listMenus = listMenus.Except(role.Menu).ToList();
             ViewBag.listMenus = listMenus;
             if (form["submit_menu"] != null)
             {
                 Strings stringModels = new Strings();
                 int[] IDMenus = stringModels.ListID(form["Menus"]);
                 ICollection<Menus> listMenu = db.Menus.Where(s => IDMenus.Contains(s.ID)).ToList();
                 foreach (Menus menu in listMenu)
                 {
                     role.Menu.Add(menu);
                 }
                 db.SaveChanges();
                 return Redirect("~/administrator/menus/addmenurole/" + roleID);
             }
             return View();
         }
         catch
         {
             return Redirect("~/");
         }
     }
     else
     {
         Session["errorContorllerAction"] = true;
         return Redirect("~/administrator");
     }
 }