add new quickups
This commit is contained in:
parent
57ee784cc6
commit
9659027b78
|
|
@ -80,6 +80,20 @@ public abstract class CommonDbContext : DbContext
|
|||
else
|
||||
return SaveError;
|
||||
}
|
||||
public async Task<Results<BadRequest<Error>, Ok<List<T2>>>> ApiSaveChangesAsyncOk<T1, T2>(IServiceProvider providers, IEnumerable<T1> value, bool apply = true, T2? response = null) where T2 : class, IAutomappedAttribute<T1, T2>, new()
|
||||
{
|
||||
if(response == null)
|
||||
response = new T2();
|
||||
if (!apply)
|
||||
return TypedResults.Ok(value.Select(x=> new T2().ApplyFrom(providers, x)).ToList());
|
||||
|
||||
var res = await ApiSaveChangesAsync();
|
||||
|
||||
if (res)
|
||||
return TypedResults.Ok(value.Select(x=> new T2().ApplyFrom(providers, x)).ToList());
|
||||
else
|
||||
return SaveError;
|
||||
}
|
||||
public async Task<Results<BadRequest<Error>, Ok>> ApiSaveChangesAsyncOk()
|
||||
{
|
||||
var res = await ApiSaveChangesAsync();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user