public ActionResult Edit(int id = -1) { FriendLinkInfo friendLinkInfo = AdminFriendLinks.GetFriendLinkById(id); if (friendLinkInfo == null) return PromptView("友情链接不存在"); FriendLinkModel model = new FriendLinkModel(); model.FriendLinkName = friendLinkInfo.Name; model.FriendLinkTitle = friendLinkInfo.Title; model.FriendLinkLogo = friendLinkInfo.Logo; model.FriendLinkUrl = friendLinkInfo.Url; model.Target = friendLinkInfo.Target; model.DisplayOrder = friendLinkInfo.DisplayOrder; Load(); return View(model); }
public ActionResult Add(FriendLinkModel model) { if (ModelState.IsValid) { FriendLinkInfo friendLinkInfo = new FriendLinkInfo() { Name = model.FriendLinkName, Title = model.FriendLinkTitle == null ? "" : model.FriendLinkTitle, Logo = model.FriendLinkLogo == null ? "" : model.FriendLinkLogo, Url = model.FriendLinkUrl, Target = model.Target, DisplayOrder = model.DisplayOrder }; AdminFriendLinks.CreateFriendLink(friendLinkInfo); AddAdminOperateLog("添加友情链接", "添加友情链接,友情链接为:" + model.FriendLinkName); return PromptView("友情链接添加成功"); } Load(); return View(model); }
public ActionResult Edit(FriendLinkModel model, int id = -1) { FriendLinkInfo friendLinkInfo = AdminFriendLinks.GetFriendLinkById(id); if (friendLinkInfo == null) return PromptView("友情链接不存在"); if (ModelState.IsValid) { friendLinkInfo.Name = model.FriendLinkName; friendLinkInfo.Title = model.FriendLinkTitle == null ? "" : model.FriendLinkTitle; friendLinkInfo.Logo = model.FriendLinkLogo == null ? "" : model.FriendLinkLogo; friendLinkInfo.Url = model.FriendLinkUrl; friendLinkInfo.Target = model.Target; friendLinkInfo.DisplayOrder = model.DisplayOrder; AdminFriendLinks.UpdateFriendLink(friendLinkInfo); AddAdminOperateLog("修改友情链接", "修改友情链接,友情链接ID为:" + id); return PromptView("友情链接修改成功"); } Load(); return View(model); }
public ActionResult Add() { FriendLinkModel model = new FriendLinkModel(); Load(); return View(model); }