improve validation and exception handling in API Controllers
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@ -48,6 +48,19 @@ namespace Oqtane.Repository
|
||||
return _db.Job.Find(jobId);
|
||||
}
|
||||
|
||||
public Job GetJob(int jobId, bool tracking)
|
||||
{
|
||||
if (tracking)
|
||||
{
|
||||
return _db.Job.Find(jobId);
|
||||
}
|
||||
else
|
||||
{
|
||||
return _db.Job.AsNoTracking().FirstOrDefault(item => item.JobId == jobId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void DeleteJob(int jobId)
|
||||
{
|
||||
Job job = _db.Job.Find(jobId);
|
||||
|
Reference in New Issue
Block a user