RecroGridETEntityOnUpdateRecAsync Method
Modifying an entity or creating a new entry.
Namespace: Recrovit.RecroGridFrameworkAssembly: Recrovit.RecroGrid (in Recrovit.RecroGrid.dll) Version: 6.1.0.23.1204.1+9d8b98a22c49d038b4e3323bfe56aa1d0eabe7ae
protected virtual Task<bool> OnUpdateRecAsync(
RecroTrack tracking,
TEntity dataRec,
RGClientParam param,
RGUIMessages messages
)
- tracking RecroTrack
- RecroTrack object and the DBContext.
- dataRec TEntity
- The current entity (data record).
- param RGClientParam
- Parameters received from the client.
- messages RGUIMessages
- Messages to be sent to the client.
TaskBooleantrue if the modification succeeded, otherwise
false.
protected override async Task<bool> OnUpdateRecAsync(RecroTrack tracking, Person dataRec, RGClientParam arg, RGUIMessages messages)
{
if (arg.IsNewEntity)
{
//New data entry with custom modifications
}
else
{
//Modify data entry with custom modifications
}
//Invoke IRecroGridUpdate
if (!await base.OnUpdateRecAsync(tracking, dataRec, arg, messages))
{
return false;
}
if (string.IsNullOrEmpty(dataRec.FirstName))
{
//Error message associated with a field from the RecroDict dictionary
messages.AddError(RecroDict.Get(RecroGridContext.HttpContext, "Person.Validation", "FirstName"), Alias2ClientName("FirstName"));
}
if (!ExternalValidation(dataRec))
{
messages.AddError("Individual dialog error message!");
}
return messages.ErrorCount == 0;
}