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});
|
2022-08-29 03:40:57 +03:00
|
|
|
dbContext.{propertyName}.Update({existingEntityVarName});
|
2022-08-28 21:39:40 +03:00
|
|
|
var result = dbContext.SaveChanges() >= 0;
|
2022-08-29 03:40:57 +03:00
|
|
|
return (result, new {returnTypeFullName}({existingEntityVarName}));
|
2022-08-27 06:19:30 +03:00
|
|
|
|
2022-08-28 21:39:40 +03:00
|
|
|
}
|