Improve validation and error handling in Controller methods

This commit is contained in:
Shaun Walker
2021-06-07 15:29:08 -04:00
parent 54cd360bb5
commit 82c05a841f
38 changed files with 922 additions and 435 deletions

View File

@ -45,10 +45,21 @@ namespace Oqtane.Repository
_db.SaveChanges();
return notification;
}
public Notification GetNotification(int notificationId)
{
return _db.Notification.Find(notificationId);
return GetNotification(notificationId, true);
}
public Notification GetNotification(int notificationId, bool tracking)
{
if (tracking)
{
return _db.Notification.Find(notificationId);
}
else
{
return _db.Notification.AsNoTracking().FirstOrDefault(item => item.NotificationId == notificationId);
}
}
public void DeleteNotification(int notificationId)