2022-08-28 21:39:40 +03:00
|
|
|
public static (bool, {returnTypeFullName}) Update{entityTypeName}(
|
|
|
|
this {contextFullName} dbContext,
|
|
|
|
{updateTypeFullName} {updateVarName},
|
|
|
|
{keyTypeFullName} {keyVarName})
|
|
|
|
{
|
|
|
|
var {existingEntityVarName} = dbContext.{propertyName}.FirstOrDefault(x => x.{keyPropertyName} == {keyVarName});
|
|
|
|
if ({existingEntityVarName} == null) return (false, null);
|
|
|
|
{existingEntityVarName}.Update({updateVarName});
|
|
|
|
dbContext.{propertyname}.Update({existingEntityVarName});
|
|
|
|
var result = dbContext.SaveChanges() >= 0;
|
|
|
|
return (result, {existingEntityVarName});
|
2022-08-27 06:19:30 +03:00
|
|
|
|
2022-08-28 21:39:40 +03:00
|
|
|
}
|