public ActionResult UploadItem(Treasure treasure) { if (ModelState.IsValid) { #region 数据初始化 treasure.BrowseNum = 0; treasure.Favorite = 0; treasure.UpdateTime = DateTime.Now; treasure.UploadTime = DateTime.Now; treasure.EditCount = 0; treasure.Link = "/Treasure/TreasureInfo?TreasureUID=" + treasure.TreasureUID.ToString(); if (string.IsNullOrEmpty(treasure.Remarks)) { treasure.Remarks = "无"; } #endregion repository.SaveTreasure(treasure); UploadImgs uploadImgs = new UploadImgs { TreasureUID = treasure.TreasureUID.ToString(), UserID = treasure.HolderID, TreasureName = treasure.TreasureName }; //再跳转到上传图片页面前,要先清空原来的图片路径 if (DropListHelper.DeletePic(treasure.TreasureUID)) { return(View("UpLoadImg", uploadImgs)); } } return(View(treasure)); }
public ActionResult EditImg(string TreasureUID) { //清空图片 if (DropListHelper.DeletePic(Guid.Parse(TreasureUID))) { Treasure treasure = repository.Treasures.Where(t => t.TreasureUID == Guid.Parse(TreasureUID)).FirstOrDefault(); return(View(new UploadImgs { TreasureUID = TreasureUID, UserID = treasure.HolderID, TreasureName = treasure.TreasureName })); } return(View("Error")); }