Server naming fixes and cleanup
Server is now completely cleaned up and without warnings
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Oqtane.Models;
|
||||
|
||||
namespace Oqtane.Repository
|
||||
@ -14,52 +14,50 @@ namespace Oqtane.Repository
|
||||
_db = context;
|
||||
}
|
||||
|
||||
public IEnumerable<Notification> GetNotifications(int SiteId, int FromUserId, int ToUserId)
|
||||
public IEnumerable<Notification> GetNotifications(int siteId, int fromUserId, int toUserId)
|
||||
{
|
||||
if (ToUserId == -1 && FromUserId == -1)
|
||||
if (toUserId == -1 && fromUserId == -1)
|
||||
{
|
||||
return _db.Notification
|
||||
.Where(item => item.SiteId == SiteId)
|
||||
.Where(item => item.SiteId == siteId)
|
||||
.Where(item => item.IsDelivered == false)
|
||||
.Include(item => item.FromUser)
|
||||
.Include(item => item.ToUser)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
return _db.Notification
|
||||
.Where(item => item.SiteId == SiteId)
|
||||
.Where(item => item.ToUserId == ToUserId || ToUserId == -1)
|
||||
.Where(item => item.FromUserId == FromUserId || FromUserId == -1)
|
||||
.Include(item => item.FromUser)
|
||||
.Include(item => item.ToUser)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
return _db.Notification
|
||||
.Where(item => item.SiteId == siteId)
|
||||
.Where(item => item.ToUserId == toUserId || toUserId == -1)
|
||||
.Where(item => item.FromUserId == fromUserId || fromUserId == -1)
|
||||
.Include(item => item.FromUser)
|
||||
.Include(item => item.ToUser)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public Notification AddNotification(Notification Notification)
|
||||
public Notification AddNotification(Notification notification)
|
||||
{
|
||||
_db.Notification.Add(Notification);
|
||||
_db.Notification.Add(notification);
|
||||
_db.SaveChanges();
|
||||
return Notification;
|
||||
return notification;
|
||||
}
|
||||
|
||||
public Notification UpdateNotification(Notification Notification)
|
||||
public Notification UpdateNotification(Notification notification)
|
||||
{
|
||||
_db.Entry(Notification).State = EntityState.Modified;
|
||||
_db.Entry(notification).State = EntityState.Modified;
|
||||
_db.SaveChanges();
|
||||
return Notification;
|
||||
return notification;
|
||||
}
|
||||
|
||||
public Notification GetNotification(int NotificationId)
|
||||
public Notification GetNotification(int notificationId)
|
||||
{
|
||||
return _db.Notification.Find(NotificationId);
|
||||
return _db.Notification.Find(notificationId);
|
||||
}
|
||||
|
||||
public void DeleteNotification(int NotificationId)
|
||||
public void DeleteNotification(int notificationId)
|
||||
{
|
||||
Notification Notification = _db.Notification.Find(NotificationId);
|
||||
_db.Notification.Remove(Notification);
|
||||
Notification notification = _db.Notification.Find(notificationId);
|
||||
_db.Notification.Remove(notification);
|
||||
_db.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user