public ActionResult Edit(TblAddress TblAddress, int id, FormCollection collection, int[] mutilManu)
        {
            if (ModelState.IsValid)
            {
                string drAddress = collection["drAddress"];

                if (drAddress == "" && drAddress != null)
                {
                    TblAddress.idCate = 0;
                }
                else
                {
                    TblAddress.idCate = int.Parse(drAddress);
                }
                db.Entry(TblAddress).State = EntityState.Modified;
                db.SaveChanges();
                var listIdManu = db.tblConnectManuToAddresses.Where(p => p.idAdress == id).ToList();
                for (int i = 0; i < listIdManu.Count; i++)
                {
                    db.tblConnectManuToAddresses.Remove(listIdManu[i]);
                    db.SaveChanges();
                }
                if (mutilManu != null)
                {
                    foreach (var idMenu in mutilManu)
                    {
                        tblConnectManuToAddress connectimage = new tblConnectManuToAddress();
                        connectimage.idManu   = idMenu;
                        connectimage.idAdress = id;
                        db.tblConnectManuToAddresses.Add(connectimage);
                        db.SaveChanges();
                    }
                }
                #region [Updatehistory]
                Updatehistoty.UpdateHistory("Edit Hotline", Request.Cookies["Username"].Values["FullName"].ToString(), Request.Cookies["Username"].Values["UserID"].ToString());
                #endregion
                if (collection["btnSave"] != null)
                {
                    Session["Thongbao"] = "<div  class=\"alert alert-info alert1\">Bạn đã sửa  thành công !<button class=\"close\" data-dismiss=\"alert\">×</button></div>";

                    return(Redirect("/address/Index"));
                }
                if (collection["btnSaveCreate"] != null)
                {
                    Session["Thongbao"] = "<div  class=\"alert alert-info\">Bạn đã thêm thành công, mời bạn thêm mới !<button class=\"close\" data-dismiss=\"alert\">×</button></div>";
                    return(Redirect("/address/Create"));
                }
            }
            return(View(TblAddress));
        }
        public ActionResult Create(TblAddress TblAddress, FormCollection collection, int[] mutilManu)
        {
            string drAddress = collection["drAddress"];

            if (drAddress == "" && drAddress != null)
            {
                TblAddress.idCate = 0;
            }
            else
            {
                TblAddress.idCate = int.Parse(drAddress);
            }
            db.TblAddress.Add(TblAddress);
            db.SaveChanges();
            var ListManu = db.TblAddress.OrderByDescending(p => p.id).Take(1).ToList();
            int id       = int.Parse(ListManu[0].id.ToString());

            if (mutilManu != null)
            {
                foreach (var idMenu in mutilManu)
                {
                    tblConnectManuToAddress connect = new tblConnectManuToAddress();
                    connect.idManu   = idMenu;
                    connect.idAdress = id;
                    db.tblConnectManuToAddresses.Add(connect);
                    db.SaveChanges();
                }
            }
            #region [Updatehistory]
            Updatehistoty.UpdateHistory("Add TblAddress", Request.Cookies["Username"].Values["FullName"].ToString(), Request.Cookies["Username"].Values["UserID"].ToString());
            #endregion
            if (collection["btnSave"] != null)
            {
                Session["Thongbao"] = "<div  class=\"alert alert-info alert1\">Bạn đã thêm thành công !<button class=\"close\" data-dismiss=\"alert\">×</button></div>";

                return(Redirect("/address/Index"));
            }
            if (collection["btnSaveCreate"] != null)
            {
                Session["Thongbao"] = "<div  class=\"alert alert-info\">Bạn đã thêm thành công, mời bạn thêm mới !<button class=\"close\" data-dismiss=\"alert\">×</button></div>";
                return(Redirect("/address/Create"));
            }
            return(Redirect("Index"));
        }