/// <summary> /// 编辑图片 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Edit(int id = 0) { Product_ImageTag model = null; if (id > 0) { model = Bll.BllProduct_ImageTag.First(o => o.Id == id); if (model == null) { return(Response404()); } } return(View(model)); }
public ActionResult Save() { int id = RequestInt("id"); string tag = RequestString("tag"); Product_ImageTag model = null; if (id > 0) { model = Bll.BllProduct_ImageTag.First(o => o.Id == id); if (model == null) { return(Response404()); } } else { model = new Product_ImageTag(); } bool isExist = Bll.BllProduct_ImageTag.IsExist(tag, model?.Id ?? 0); if (isExist) { return(LayerAlertErrorAndReturn("标签已存在!")); } model.Tag = tag; model.AddTime = DateTime.Now; int rows = id > 0 ? Bll.BllProduct_ImageTag.Update(model) : Bll.BllProduct_ImageTag.Insert(model); if (rows > 0) { return(LayerAlertSuccessAndRefresh("操作成功!")); } else { return(LayerAlertErrorAndReturn("操作失败!")); } }