public static ReadingNewsOutDTO ReadingNews(DeleteNewsInDTO inDto) { ReadingNewsOutDTO outDto = new ReadingNewsOutDTO(); try { if (inDto == null || string.IsNullOrEmpty(inDto.Id)) { outDto.ErrorMsg = "参数错误"; return(outDto); } News news = NewsService.GetNews(inDto.Id, LoadType.DataBaseDirect); if (news == null) { outDto.ErrorMsg = "新闻不存在"; return(outDto); } news.ReadingQuantity++; PersisterService.SaveObject(news); outDto.IsSucceed = true; outDto.ReadingQuantity = news.ReadingQuantity; } catch (Exception ex) { outDto.ErrorMsg = ex.Message; LogProxy.Error(ex, false); } return(outDto); }
public static DeleteNewsOutDTO DeleteNews(DeleteNewsInDTO inDto) { DeleteNewsOutDTO outDto = new DeleteNewsOutDTO(); try { if (inDto == null || string.IsNullOrEmpty(inDto.Id)) { outDto.ErrorMsg = "参数错误"; return(outDto); } News news = NewsService.GetNews(inDto.Id, LoadType.DataBaseDirect); if (news == null) { outDto.ErrorMsg = "新闻不存在"; return(outDto); } news.IsDeleted = true; string remark = "删除新闻"; SystemLog systemLog = LogService.CreateSystemLog(SystemLogType.DeleteNews, typeof(News), news.Id, remark); PersisterService.SaveObject(new SRO[] { news, systemLog }); outDto.IsSucceed = true; } catch (Exception ex) { outDto.ErrorMsg = ex.Message; LogProxy.Error(ex, false); } return(outDto); }