Exemple #1
0
 public ActionResult Index() {
     if (LicenseSettingsHelper.LicenseIsInstalled())
         return RedirectToRoute("HomePage");
     var model = new LicenseModel() {
         MachineCode = _machineCodeProvider.GetMachineCode(),
         LicenseCode = ""
     };
     return View(model);
 }
Exemple #2
0
        public ActionResult Index(LicenseModel model) {
            if (LicenseSettingsHelper.LicenseIsInstalled())
                return RedirectToRoute("HomePage");

            if (ModelState.IsValid) {
                if (_licenseService.TryCheckAccess(model.LicenseCode)) {
                    _licenseService.Install(model.LicenseCode);
                    LicenseSettingsHelper.ResetCache();
                    return RedirectToRoute("HomePage");
                }

                ModelState.AddModelError("", "序列号不正确,请重新填写!");
            }
            return View(model);
        }