using Lottomat.Application.Entity.PublicInfoManage;
using Lottomat.Application.IService.PublicInfoManage;
using Lottomat.Data.Repository;
using Lottomat.Util.Extension;
using System.Collections.Generic;
using System.Linq;
namespace Lottomat.Application.Service.PublicInfoManage
{
///
/// 版 本 1.0
/// Copyright (c) 2016-2017
/// 创建人:赵轶
/// 日 期:2015.12.8 11:31
/// 描 述:邮件分类
///
public class EmailCategoryService : RepositoryFactory, IEmailCategoryService
{
#region 获取数据
///
/// 分类列表
///
/// 用户Id
///
public IEnumerable GetList(string UserId)
{
var expression = LinqExtensions.True();
expression = expression.And(t => t.CreateUserId == UserId);
return this.BaseRepository().IQueryable(expression).ToList();
}
///
/// 分类实体
///
/// 主键值
///
public EmailCategoryEntity GetEntity(string keyValue)
{
return this.BaseRepository().FindEntity(keyValue);
}
#endregion
#region 提交数据
///
/// 删除分类
///
/// 主键
public void RemoveForm(string keyValue)
{
this.BaseRepository().Delete(keyValue);
}
///
/// 保存分类表单(新增、修改)
///
/// 主键值
/// 分类实体
///
public void SaveForm(string keyValue, EmailCategoryEntity emailCategoryEntity)
{
if (!string.IsNullOrEmpty(keyValue))
{
emailCategoryEntity.Modify(keyValue);
this.BaseRepository().Update(emailCategoryEntity);
}
else
{
emailCategoryEntity.Create();
this.BaseRepository().Insert(emailCategoryEntity);
}
}
#endregion
}
}