2022-08-27 06:19:30 +03:00
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
|
|
namespace {Namespace}
|
|
|
|
{
|
|
|
|
public static partial class {entityTypeName}Extensions {
|
2022-08-27 23:02:46 +03:00
|
|
|
public static (bool, {readTypeFullName}) Update{entityTypeName}(
|
|
|
|
this {contextFullName} dbContext, {updateTypeFullName} {toUpdateVarName}) {
|
|
|
|
var {newEntityVarName} = new {entityTypeFullName}({toUpdateVarName});
|
2022-08-27 06:19:30 +03:00
|
|
|
dbContext.{propertyName}.Add({newEntityVarName});
|
|
|
|
var success = dbContext.SaveChanges() >= 0;
|
|
|
|
return (success, new {readTypeFullName}({newEntityVarName}));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|