更新crud
This commit is contained in:
@@ -158,13 +158,12 @@ namespace Yi.Framework.Ddd.Services
|
|||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(id));
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ TemplateFactory templateFactory = new();
|
|||||||
//List<string> entityNames = new() { "_" };
|
//List<string> entityNames = new() { "_" };
|
||||||
string modelName = "Dictionary";
|
string modelName = "Dictionary";
|
||||||
string nameSpaces = "Yi.RBAC";
|
string nameSpaces = "Yi.RBAC";
|
||||||
List<string> entityNames = new() { "_" };
|
|
||||||
List<string> entityNames = new() { "_", "_" };
|
List<string> entityNames = new() { "_", "_" };
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user