Hello, in JobsContainer.razor you have the method UpdateJobAsync:
public JobModel Payload { get; set; }
public async Task UpdateJobAsync(JobStatuses newStatus)
{
var task = Jobs.SingleOrDefault(x => x.Id == Payload.Id);
if (task != null)
{
task.Status = newStatus;
task.LastUpdated = DateTime.Now;
await OnStatusUpdated.InvokeAsync(Payload);
}
}
I was wondering why you create the task variable and not simply change the properties of the Payload property directly:
public JobModel Payload { get; set; }
public async Task UpdateJobAsync(JobStatuses newStatus)
{
if (Payload != null)
{
Payload.Status = newStatus;
Payload.LastUpdated = DateTime.Now;
await OnStatusUpdated.InvokeAsync(Payload);
}
}
It looks like Payload and task reference the same object of the Jobs collection. Maybe I'm missing something. Is there any reason you did it this way?
Hello, in
JobsContainer.razoryou have the methodUpdateJobAsync:I was wondering why you create the
taskvariable and not simply change the properties of thePayloadproperty directly:It looks like
Payloadandtaskreference the same object of theJobscollection. Maybe I'm missing something. Is there any reason you did it this way?