コード例 #1
0
 public ActionResult WhiteListMobileTypeEdit(string id)
 {
     OTAWhiteList model = new OTAWhiteList();
     var currentDesignCompanyId = UserAccessDataControlService.GetCurrentDesignCompanyId(true);
     if (!string.IsNullOrEmpty(currentDesignCompanyId))
     {
         model = RedisService.GetSubModel<DesignCompany, OTAWhiteList>(currentDesignCompanyId, id);
     }
     return View(model);
 }
コード例 #2
0
        public ActionResult WhiteListMobileTypeEdit(OTAWhiteList model)
        {
            if (!ValidateModel())
            {
                return RedirectToAction("WhiteListMobileTypeEdit", new { id = model.Id });
            }
            var currentDesignCompanyId = UserAccessDataControlService.GetCurrentDesignCompanyId(true);
            if (!string.IsNullOrEmpty(currentDesignCompanyId))
            {
                var productNo = model.MobileModel.ToLower().Trim();
                model.ProductNo = productNo;
                RedisService.SetSubModel<DesignCompany, OTAWhiteList>(currentDesignCompanyId, model);
            }

            return RedirectToAction("WhiteListMobileTypeList");
        }
コード例 #3
0
        public ActionResult WhiteListMobileTypeAdd(OTAWhiteList model)
        {
            if (!ValidateModel())
            {
                return RedirectToAction("WhiteListMobileTypeAdd");
            }
            var productNo = model.MobileModel.ToLower().Trim();
            model.ProductNo = productNo;
            var currentDesignCompanyId = UserAccessDataControlService.GetCurrentDesignCompanyId(true);

            var allOTAWhiteList = RedisService.GetAllSubModelsByType<DesignCompany, OTAWhiteList>(currentDesignCompanyId);

            var hasSameNameOTAWhiteList = allOTAWhiteList.Exists(x => x.MobileModel.ToUpper() == model.MobileModel.ToUpper().Trim());
            if (hasSameNameOTAWhiteList)
            {
                TempData["errorMsg"] = "特殊型号不能重复!";
                return RedirectToAction("WhiteListMobileTypeAdd");
            }

            if (!string.IsNullOrEmpty(currentDesignCompanyId))
            {
                model.Id = Guid.NewGuid().ToString();
                RedisService.SetSubModel<DesignCompany, OTAWhiteList>(currentDesignCompanyId, model);
            }
            return RedirectToAction("WhiteListMobileTypeList");
        }