using Lottomat.Application.Entity.AttachmentManage;
using Lottomat.Application.IService.AttachmentManage;
using Lottomat.Data.Repository;
using Lottomat.Util.WebControl;
using System.Collections.Generic;
using System.Linq;
namespace Lottomat.Application.Service.AttachmentManage
{
///
/// 版 本 1.0
/// Copyright (c) 2016-2017
/// 创 建:超级管理员
/// 日 期:2017-06-05 15:31
/// 描 述:附件
///
public class AttachmentService : RepositoryFactory, AttachmentIService
{
#region 获取数据
///
/// 获取列表
///
/// 分页
/// 查询参数
/// 返回分页列表
public IEnumerable GetPageList(Pagination pagination, string queryJson)
{
return this.BaseRepository().FindList(pagination);
}
///
/// 获取列表
///
/// 查询参数
/// 返回列表
public IEnumerable GetList(string queryJson)
{
return this.BaseRepository().IQueryable().ToList();
}
///
/// 获取实体
///
/// 主键值
///
public AttachmentEntity GetEntity(string keyValue)
{
return this.BaseRepository().FindEntity(keyValue);
}
#endregion
#region 提交数据
///
/// 删除数据
///
/// 主键
public void RemoveForm(string keyValue)
{
this.BaseRepository().Delete(keyValue);
}
///
/// 保存表单(新增、修改)
///
/// 主键值
/// 实体对象
///
public void SaveForm(string keyValue, AttachmentEntity entity)
{
if (!string.IsNullOrEmpty(keyValue))
{
entity.Modify(keyValue);
this.BaseRepository().Update(entity);
}
else
{
entity.Create();
this.BaseRepository().Insert(entity);
}
}
///
/// 添加一个附件
///
/// 附件实体
///
public AttachmentEntity AddOne(AttachmentEntity entity)
{
entity.Create();
int rel = this.BaseRepository().Insert(entity);
return entity;
}
#endregion
}
}