|
using JiepeiWMS.IServices;
|
using JiepeiWMS.Model.Models;
|
using JiepeiWMS.Services.BASE;
|
using JiepeiWMS.IRepository.Base;
|
using JiepeiWMS.Repository.Base;
|
using System.Threading.Tasks;
|
|
namespace JiepeiWMS.Services
|
{
|
public class DepartmentServices : BaseServices<Department>, IDepartmentServices
|
{
|
private readonly IBaseRepository<Department> _dal;
|
public DepartmentServices(IBaseRepository<Department> dal)
|
{
|
this._dal = dal;
|
base.BaseDal = dal;
|
}
|
|
/// <summary>
|
/// 移动到指定位置
|
/// </summary>
|
/// <param name="Model">被移动模型</param>
|
/// <param name="MoveId">目标模型的Id</param>
|
/// <returns>错误信息</returns>
|
public async Task<string> Move(Department Model, int MoveId)
|
{
|
await _dal._TreeAutoSetValues(MoveId, Model);
|
return string.Empty;
|
}
|
|
/// <summary>
|
/// 添加
|
/// </summary>
|
/// <param name="Model">模型</param>
|
/// <returns>主键</returns>
|
public async Task<int> AddInfo(Department Model)
|
{
|
Model.Id = await BaseDal.Add(Model);
|
await BaseDal._TreeAutoSetValues(Model);
|
await BaseDal.Update(Model);
|
return Model.Id;
|
}
|
|
/// <summary>
|
/// 编辑
|
/// </summary>
|
/// <param name="Model">模型</param>
|
/// <returns>主键</returns>
|
public async Task<string> EditInfo(Department Model)
|
{
|
await BaseDal._TreeAutoSetValues(Model);
|
await BaseDal.Update(Model);
|
return string.Empty;
|
}
|
|
}
|
}
|