public ActionResult ChangeSetting()
        {
            string fileName = Server.MapPath("~/Resources/MySecretFile.xml");

            DataSet ds = new DataSet();

            ds.ReadXml(fileName);
            SettingInformations model = new SettingInformations()
            {
                MotherBoardId = ds.Tables[0].Rows[0]["md"].ToString(),
                CpudId        = ds.Tables[0].Rows[0]["cd"].ToString(),

                Cigher        = ds.Tables[0].Rows[0]["ci"].ToString().Equals("true")?true:false,
                SaveDataBase  = ds.Tables[0].Rows[0]["sd"].ToString().Equals("true")?true:false
                , CigherFiles = ds.Tables[0].Rows[0]["cf"].ToString().Equals("true") ? true : false
            };

            return(View(model));
        }
        public ActionResult ChangeSetting(SettingInformations model)
        {
            string fileName = Server.MapPath("~/Resources/MySecretFile.xml");

            DataSet ds = new DataSet();

            ds.ReadXml(fileName);


            if (ModelState.IsValid)
            {
                if (ConfirmLogin(model.UserName, model.Password))
                {
                    ds.Tables[0].Rows[0]["sd"] = (model.SaveDataBase == true)?"true":"false";
                    ds.Tables[0].Rows[0]["ci"] = (model.Cigher == true) ? "true" : "false";
                    ds.Tables[0].Rows[0]["cf"] = (model.Cigher == true) ? "true" : "false";

                    ds.Tables[0].Rows[0]["md"] = ManagedAes.EncryptText(model.MotherBoardId);
                    ds.Tables[0].Rows[0]["cd"] = ManagedAes.EncryptText(model.CpudId);


                    ds.WriteXml(fileName);


                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    ModelState.AddModelError("UserName", "خطأ في التأكيد ");
                    ModelState.AddModelError("Password", "خطأ في التأكيد");

                    return(View(model));
                }
            }

            return(View());
        }