public void DeleteArticle(params long[] ids) { //var artiles = Context.ArticleInfo.FindBy(item => ids.Contains(item.Id)); //Context.ArticleInfo.RemoveRange(artiles); //Context.SaveChanges(); DbFactory.Default.Del <ArticleInfo>(p => p.Id.ExIn(ids)); foreach (long id in ids) { string path = "/Storage/Plat/Article/" + id; if (MallIO.ExistDir(path)) { MallIO.DeleteDir(path, true); } } }
public ActionResult Add(BonusModel model) { if (!string.IsNullOrEmpty(model.ImagePath)) { if (!MallIO.ExistDir("/Storage/Plat/Bonus")) { MallIO.CreateDir("/Storage/Plat/Bonus"); } //转移图片 if (model.ImagePath.Contains("/temp/")) { string source = model.ImagePath.Substring(model.ImagePath.LastIndexOf("/temp")); string dest = @"/Storage/Plat/Bonus/"; model.ImagePath = Path.Combine(dest, Path.GetFileName(source)); Core.MallIO.CopyFile(source, model.ImagePath, true); } else if (model.ImagePath.Contains("/Storage/")) { model.ImagePath = model.ImagePath.Substring(model.ImagePath.LastIndexOf("/Storage")); } } else { model.ImagePath = ""; } model.StartTime = DateTime.Now; if (Mall.Entities.BonusInfo.BonusType.Prize == model.Type) { model.EndTime = DateTime.Now.AddYears(20); } string url = CurrentUrlHelper.CurrentUrlNoPort() + "/m-weixin/bonus/index/"; _iBonusService.Add(model, url); return(RedirectToAction("Management")); throw new MallException("验证失败"); }