thesis/ResoursesManager/ResoursesManager/Repositories/NotificationRepository.cs
2019-04-28 09:55:22 +02:00

47 lines
1.2 KiB
C#

using ResourcesManager.Interfaces;
using ResourcesManager.Models;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
namespace ResourcesManager.Repositories
{
public class NotificationRepository : BaseRepository, INotificationRepository
{
public NotificationRepository(ApplicationDbContext context) : base(context) { }
public bool DeleteNotification(int id)
{
var notification = Context.Notifications.Find(id);
Context.Notifications.Remove(notification);
Save();
return true;
}
public Notification GetNotificationByID(int id)
{
return Context.Notifications.Find(id);
}
public IEnumerable<Notification> GetNotifications()
{
return Context.Notifications;
}
public bool InsertNotification(Notification notification)
{
Context.Notifications.Add(notification);
Save();
return true;
}
public bool UpdateNotification(Notification notification)
{
Context.Entry(notification).State = EntityState.Modified;
Save();
return true;
}
}
}