|
|
|
@ -2,6 +2,7 @@ |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Shentun.Peis.HelperDto; |
|
|
|
using Shentun.Peis.Models; |
|
|
|
using Shentun.Peis.Sexs; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
@ -20,14 +21,34 @@ namespace Shentun.Peis.ForSexs |
|
|
|
public class ForSexAppService : ApplicationService |
|
|
|
{ |
|
|
|
private readonly IRepository<ForSex> _forSexRepository; |
|
|
|
|
|
|
|
private readonly ForSexManager _manager; |
|
|
|
public ForSexAppService( |
|
|
|
IRepository<ForSex> forSexRepository |
|
|
|
IRepository<ForSex> forSexRepository, |
|
|
|
ForSexManager manager |
|
|
|
) |
|
|
|
{ |
|
|
|
this._forSexRepository = forSexRepository; |
|
|
|
this._manager = manager; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 修改
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="Id">主键ID</param>
|
|
|
|
/// <param name="input">修改参数</param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("api/app/forsex/update")] |
|
|
|
public async Task<ForSexDto> UpdateAsync(char Id, UpdateForSexDto input) |
|
|
|
{ |
|
|
|
var entity = await _forSexRepository.GetAsync(m => m.Id == Id); |
|
|
|
var sourceEntity = ObjectMapper.Map<UpdateForSexDto, ForSex>(input); |
|
|
|
await _manager.UpdateAsync(sourceEntity, entity); |
|
|
|
entity = await _forSexRepository.UpdateAsync(entity); |
|
|
|
return ObjectMapper.Map<ForSex, ForSexDto>(entity); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 获取适用性别列表
|
|
|
|
/// </summary>
|
|
|
|
|