public ActionResult Create(News news, HttpPostedFileBase newsImage) { news.NewsTime = news.NewsTime ?? DateTime.Now; BizNews.Insert(news,0); string savePath=SaveImage(newsImage,news.NewsID); news.ImagePath = savePath; news.Summary = StringUtility.ClearHtmlTags(news.Content, 90); news.IsPublished = (int)EnumPublishState.���; BizNews.Update(news); return RedirectToAction("Index", "AdminNewsCategory", new { id = news.CategoryID }); }
public ActionResult Edit(int id, int? orderNo, News news, HttpPostedFileBase newsImage) { news.NewsID = id; string savePath=SaveImage(newsImage, id); news.ImagePath = savePath == null ? news.ImagePath : savePath; news.Summary = StringUtility.ClearHtmlTags(news.Content, 90); BizNews.UpdateAll(news, orderNo ?? 0); var category = BizNewsCategory.Get(news.CategoryID); ViewData["Category"] = category; ViewData["SourceFromList"] = GetSourceFromList(); ViewData["IsEdit"] = true; ViewData["Successed"] = true; return RedirectToAction("Edit", new { id=id,orderNo=orderNo }); }
partial void UpdateNews(News instance);
partial void DeleteNews(News instance);
partial void InsertNews(News instance);
private void detach_News(News entity) { this.SendPropertyChanging(); entity.SourceFrom = null; }
private void attach_News(News entity) { this.SendPropertyChanging(); entity.SourceFrom = this; }
private void detach_News(News entity) { this.SendPropertyChanging(); entity.NewsCategory = null; }
private void attach_News(News entity) { this.SendPropertyChanging(); entity.NewsCategory = this; }