Exemplo n.º 1
0
        public ActionResult Edit2(UpdateNewsInput modle)
        {
            modle.CreateDate = DateTime.Now;
            modle.CreateID   = this.CurrentSession.UserId;
            this.Service.Update(modle);

            return(RedirectToAction("Comment"));
        }
Exemplo n.º 2
0
        public ActionResult Edit(UpdateNewsInput modle)
        {
            modle.CreateDate = DateTime.Now;
            modle.CreateID   = this.CurrentSession.UserId;
            this.Service.Update(modle);

            return(this.SuccessMsg("编辑成功"));
        }
Exemplo n.º 3
0
        public async Task UpdateNews(UpdateNewsInput input)
        {
            if (!input.AllProjects && input.Projects.Count == 0)
            {
                throw new UserFriendlyException("不区分小区,所属小区至少选择一样!");
            }
            var news = await _newsRepository.GetAsync(input.Id); input.MapTo(news);
            await _newsRepository.UpdateAsync(news);

            _detailManager.Save(DetailType.News, news.Id, input.Content);
            await _newsProjectRepository.DeleteAsync(t => t.NewsId == news.Id);

            if (!input.AllProjects)
            {
                foreach (var project in input.Projects)
                {
                    await _newsProjectRepository.InsertAsync(new NewsProject()
                    {
                        NewsId    = news.Id,
                        ProjectId = project
                    });
                }
            }
        }