更新crud

This commit is contained in:
橙子
2023-02-05 22:59:22 +08:00
parent 95484877a3
commit 1d7c17e253
3 changed files with 38 additions and 6 deletions

View File

@@ -158,13 +158,12 @@ namespace Yi.Framework.Ddd.Services
{
throw new ArgumentNullException(nameof(id));
}
var entity = await MapToEntityAsync(input);
entity.Id = id;
await _repository.UpdateIgnoreNullAsync(entity);
var newEntity = await _repository.GetByIdAsync(id);
var entity = await _repository.GetByIdAsync(id);
await MapToEntityAsync(input, entity);
await _repository.UpdateAsync(entity);
return await MapToGetOutputDtoAsync(newEntity);
return await MapToGetOutputDtoAsync(entity);
}
}
}

View File

@@ -19,7 +19,6 @@ TemplateFactory templateFactory = new();
//List<string> entityNames = new() { "_" };
string modelName = "Dictionary";
string nameSpaces = "Yi.RBAC";
List<string> entityNames = new() { "_" };
List<string> entityNames = new() { "_", "_" };

View File

@@ -0,0 +1,34 @@
using NET.AutoWebApi.Setting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Ddd.Services;
namespace Yi.RBAC.Application
{
class Test01
{
public string Name { get; set; }
public bool State { get; set; }
}
class Test02
{
public string Name { get; set; }
}
public class TestService : ApplicationService, IAutoApiService
{
public void Test()
{
var t001 = new Test02 { Name = "121233" };
var t002 = new Test01 { Name = "123", State = true };
var entity= _mapper.Map(t001, t002);
}
}
}