using Edu.Model.ViewModel.Web;
using Edu.Repository.Web;
using System.Collections.Generic;
using VT.FW.DB;
namespace Edu.Module.Web
{
///
/// 网站新闻处理类
///
public class WebNewsModule
{
///
/// 网站新闻管理仓储层对象
///
private readonly RB_Web_NewsRepository web_NewsRepository = new RB_Web_NewsRepository();
///
/// 网站新闻类型仓储层对象
///
private readonly RB_Web_NewsTypeRepository web_NewsTypeRepository = new RB_Web_NewsTypeRepository();
///
/// 品牌月刊管理仓储层对象
///
private readonly RB_Web_MonthlyRepository web_MonthlyRepository = new RB_Web_MonthlyRepository();
///
/// 品牌漫画管理仓储层对象
///
private readonly RB_Web_CartoonRepository web_CartoonRepository = new RB_Web_CartoonRepository();
#region 新闻管理
///
/// 获取网站新闻分页列表
///
/// 页码
/// 每页显示调试
/// 总条数
/// 查询条件
///
public List GetWebNewsPageModule(int pageIndex, int pageSize, out long rowsCount, RB_Web_News_ViewModel query)
{
return web_NewsRepository.GetWebNewsPageRepository(pageIndex, pageSize, out rowsCount, query);
}
///
/// 获取网站新闻列表
///
/// 查询条件
///
public List GetWebNewsListModule(RB_Web_News_ViewModel query)
{
return web_NewsRepository.GetWebNewsListRepository(query);
}
///
/// 新增修改新闻
///
///
///
public bool SetWebNewsModule(RB_Web_News_ViewModel model)
{
bool flag;
if (model.Id > 0)
{
Dictionary fileds = new Dictionary()
{
{nameof(RB_Web_News_ViewModel.Title),model.Title },
{nameof(RB_Web_News_ViewModel.Img),model.Img },
{nameof(RB_Web_News_ViewModel.Content),model.Content },
{nameof(RB_Web_News_ViewModel.TypeId),model.TypeId },
};
flag = web_NewsRepository.Update(fileds, new WhereHelper(nameof(RB_Web_News_ViewModel.Id), model.Id));
}
else
{
var newId = web_NewsRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
///
/// 根据编号获取网站新闻详情
///
///
///
public RB_Web_News_ViewModel GetWebNewsModule(object Id)
{
return web_NewsRepository.GetEntity(Id);
}
///
/// 修改网站新闻状态
///
///
/// 0-正常,1-删除
///
public bool RemoveWebNewsStatusModule(int Id, int Status)
{
Dictionary fileds = new Dictionary()
{
{nameof(RB_Web_News_ViewModel.Status),Status },
};
var flag = web_NewsRepository.Update(fileds, new WhereHelper(nameof(RB_Web_News_ViewModel.Id), Id));
return flag;
}
#endregion
#region 新闻类型管理
///
/// 获取网站新闻类型分页列表
///
/// 页码
/// 每页显示调试
/// 总条数
/// 查询条件
///
public List GetWebNewsTypePageModule(int pageIndex, int pageSize, out long rowsCount, RB_Web_NewsType_ViewModel query)
{
return web_NewsTypeRepository.GetWebNewsTypePageRepository(pageIndex, pageSize, out rowsCount, query);
}
///
/// 获取网站新闻类型列表
///
/// 查询条件
///
public List GetWebNewsTypeListModule(RB_Web_NewsType_ViewModel query)
{
return web_NewsTypeRepository.GetWebNewsTypeListRepository(query);
}
///
/// 新增修改新闻类型
///
///
///
public bool SetWebNewsTypeModule(RB_Web_NewsType_ViewModel model)
{
bool flag;
if (model.Id > 0)
{
Dictionary fileds = new Dictionary()
{
{nameof(RB_Web_NewsType_ViewModel.TypeName),model.TypeName },
{nameof(RB_Web_NewsType_ViewModel.Image),model.Image },
};
flag = web_NewsTypeRepository.Update(fileds, new WhereHelper(nameof(RB_Web_NewsType_ViewModel.Id), model.Id));
}
else
{
var newId = web_NewsTypeRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
///
/// 根据编号获取网站新闻类型详情
///
///
///
public RB_Web_NewsType_ViewModel GetWebNewsTypeModule(object Id)
{
return web_NewsTypeRepository.GetEntity(Id);
}
///
/// 修改网站新闻类型状态
///
///
/// 0-正常,1-删除
///
public bool RemoveWebNewsTypeStatusModule(int Id, int Status)
{
Dictionary fileds = new Dictionary()
{
{nameof(RB_Web_NewsType_ViewModel.Status),Status },
};
var flag = web_NewsTypeRepository.Update(fileds, new WhereHelper(nameof(RB_Web_NewsType_ViewModel.Id), Id));
return flag;
}
#endregion
#region 品牌动漫管理
///
/// 获取品牌卡通分页列表
///
/// 页码
/// 每页显示调试
/// 总条数
/// 查询条件
///
public List GetWebCartoonPageModule(int pageIndex, int pageSize, out long rowsCount, RB_Web_Cartoon_ViewModel query)
{
return web_CartoonRepository.GetWebCartoonPageRepository(pageIndex, pageSize, out rowsCount, query);
}
///
/// 新增修改品牌动漫
///
///
///
public bool SetWebCartoonModule(RB_Web_Cartoon_ViewModel model)
{
bool flag;
if (model.Id > 0)
{
Dictionary fileds = new Dictionary()
{
{nameof(RB_Web_Cartoon_ViewModel.Name),model.Name },
{nameof(RB_Web_Cartoon_ViewModel.LinkUrl),model.LinkUrl },
};
flag = web_CartoonRepository.Update(fileds, new WhereHelper(nameof(RB_Web_NewsType_ViewModel.Id), model.Id));
}
else
{
var newId = web_CartoonRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
///
/// 根据编号获取品牌卡通详情
///
///
///
public RB_Web_Cartoon_ViewModel GetWebCartoonModule(object Id)
{
return web_CartoonRepository.GetEntity(Id);
}
///
/// 修改品牌卡通状态
///
///
/// 0-正常,1-删除
///
public bool RemoveWebCartoonStatusModule(int Id, int Status)
{
Dictionary fileds = new Dictionary()
{
{nameof(RB_Web_Cartoon_ViewModel.Status),Status },
};
var flag = web_CartoonRepository.Update(fileds, new WhereHelper(nameof(RB_Web_Cartoon_ViewModel.Id), Id));
return flag;
}
#endregion
#region 品牌月刊管理
///
/// 获取品牌月刊分页列表
///
/// 页码
/// 每页显示调试
/// 总条数
/// 查询条件
///
public List GetWebMonthlyPageModule(int pageIndex, int pageSize, out long rowsCount, RB_Web_Monthly_ViewModel query)
{
return web_MonthlyRepository.GetWebMonthlyPageRepository(pageIndex, pageSize, out rowsCount, query);
}
///
/// 新增修改品牌月刊
///
///
///
public bool SetWebMonthlyModule(RB_Web_Monthly_ViewModel model)
{
bool flag;
if (model.Id > 0)
{
Dictionary fileds = new Dictionary()
{
{nameof(RB_Web_Monthly_ViewModel.Name),model.Name },
{nameof(RB_Web_Monthly_ViewModel.LinkUrl),model.LinkUrl },
{nameof(RB_Web_Monthly_ViewModel.CoverImg),model.CoverImg },
};
flag = web_MonthlyRepository.Update(fileds, new WhereHelper(nameof(RB_Web_Monthly_ViewModel.Id), model.Id));
}
else
{
var newId = web_MonthlyRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
///
/// 根据编号获取品牌月刊详情
///
///
///
public RB_Web_Monthly_ViewModel GetWebMonthlyModule(object Id)
{
return web_MonthlyRepository.GetEntity(Id);
}
///
/// 修改品牌月刊状态
///
///
/// 0-正常,1-删除
///
public bool RemoveWebMonthlyStatusModule(int Id, int Status)
{
Dictionary fileds = new Dictionary()
{
{nameof(RB_Web_Monthly_ViewModel.Status),Status },
};
var flag = web_MonthlyRepository.Update(fileds, new WhereHelper(nameof(RB_Web_Monthly_ViewModel.Id), Id));
return flag;
}
#endregion
}
}