improve validation and exception handling in API Controllers

This commit is contained in:
Shaun Walker
2021-06-15 19:11:00 -04:00
parent 0a2293119e
commit 65a14da5a9
14 changed files with 101 additions and 150 deletions

View File

@ -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);