using Infrastructure.Attribute;
using Infrastructure.Extensions;
using ZR.LiveForum.Model.Liveforum.Dto;
using ZR.LiveForum.Model.Liveforum;
using ZR.Repository;
using ZR.Service.Liveforum.ILiveforumService;
namespace ZR.Service.Liveforum
{
///
/// 系统公告Service业务层处理
///
[AppService(ServiceType = typeof(IT_SystemNotificationsService), ServiceLifetime = LifeTime.Transient)]
public class T_SystemNotificationsService : BaseService, IT_SystemNotificationsService
{
///
/// 查询系统公告列表
///
///
///
public PagedInfo GetList(T_SystemNotificationsQueryDto parm)
{
var predicate = QueryExp(parm);
var response = Queryable()
//.OrderBy("Id desc")
.Where(predicate.ToExpression())
.ToPage(parm);
return response;
}
///
/// 获取详情
///
///
///
public T_SystemNotifications GetInfo(long Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
///
/// 添加系统公告
///
///
///
public T_SystemNotifications AddT_SystemNotifications(T_SystemNotifications model)
{
return Insertable(model).ExecuteReturnEntity();
}
///
/// 修改系统公告
///
///
///
public int UpdateT_SystemNotifications(T_SystemNotifications model)
{
return Update(model, true);
}
///
/// 查询导出表达式
///
///
///
private static Expressionable QueryExp(T_SystemNotificationsQueryDto parm)
{
var predicate = Expressionable.Create();
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.Title), it => it.Title.Contains(parm.Title));
return predicate;
}
}
}