14 lines
583 B
C#
14 lines
583 B
C#
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace {Namespace}
|
|
{
|
|
public static partial class {entityTypeName}Extensions {
|
|
public static (bool, {readTypeFullName}) Update{entityTypeName}(
|
|
this {contextFullName} dbContext, {updateTypeFullName} {toUpdateVarName}) {
|
|
var {newEntityVarName} = new {entityTypeFullName}({toUpdateVarName});
|
|
dbContext.{propertyName}.Add({newEntityVarName});
|
|
var success = dbContext.SaveChanges() >= 0;
|
|
return (success, new {readTypeFullName}({newEntityVarName}));
|
|
}
|
|
}
|
|
} |