public ActionResult EmailRobot() { SimpleAES __aes = new SimpleAES(); var entity = _settingRepo.GetEntry(1); SettingEmailRobotVM vm = new SettingEmailRobotVM(); vm.InjectFrom(entity); vm.sys_email_robot_pw = __aes.DecryptString(entity.sys_email_robot_pw); return(View(vm)); }
public ActionResult EmailRobot(SettingEmailRobotVM viewmodel) { if (ModelState.IsValid) { SimpleAES __aes = new SimpleAES(); var entity = _settingRepo.GetEntry(1); entity.InjectFrom(viewmodel); entity.sys_email_robot_pw = __aes.EncryptToString(viewmodel.sys_email_robot_pw); _settingRepo.Update(entity); _settingRepo.Save(); CacheServ.ClearAll(); TempData["message"] = "Update setting successfully!"; return(RedirectToAction("EmailRobot")); } return(View(viewmodel)); }