public ActionResult Edit(ShipCompanyModel model, int shipCoId = -1) { ShipCompanyInfo shipCompanyInfo = AdminShipCompanies.GetShipCompanyById(shipCoId); if (shipCompanyInfo == null) { return(PromptView("配送公司不存在")); } int shipCoId2 = AdminShipCompanies.GetShipCoIdByName(model.CompanyName); if (shipCoId2 > 0 && shipCoId2 != shipCoId) { ModelState.AddModelError("CompanyName", "名称已经存在"); } if (ModelState.IsValid) { shipCompanyInfo.DisplayOrder = model.DisplayOrder; shipCompanyInfo.Name = model.CompanyName; AdminShipCompanies.UpdateShipCompany(shipCompanyInfo); AddAdminOperateLog("修改配送公司", "修改配送公司,配送公司ID为:" + shipCoId); return(PromptView("配送公司修改成功")); } ViewData["referer"] = ShopUtils.GetAdminRefererCookie(); return(View(model)); }
public ActionResult Edit(int shipCoId = -1) { ShipCompanyInfo shipCompanyInfo = AdminShipCompanies.GetShipCompanyById(shipCoId); if (shipCompanyInfo == null) { return(PromptView("配送公司不存在")); } ShipCompanyModel model = new ShipCompanyModel(); model.DisplayOrder = shipCompanyInfo.DisplayOrder; model.CompanyName = shipCompanyInfo.Name; ViewData["referer"] = ShopUtils.GetAdminRefererCookie(); return(View(model)); }