Refactoring - split data, logic and model layers; custom network exception
This commit is contained in:
40
StudentHouseDashboard/Logic/AnnouncementManager.cs
Normal file
40
StudentHouseDashboard/Logic/AnnouncementManager.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Models;
|
||||
using Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Logic
|
||||
{
|
||||
public class AnnouncementManager
|
||||
{
|
||||
private AnnouncementRepository announcementRepository;
|
||||
public AnnouncementManager()
|
||||
{
|
||||
announcementRepository = new AnnouncementRepository();
|
||||
}
|
||||
public List<Announcement> GetAllAnnouncements()
|
||||
{
|
||||
return announcementRepository.GetAllAnnouncements();
|
||||
}
|
||||
public List<Announcement> GetAnnouncementsByPage(int? p, int? c)
|
||||
{
|
||||
return announcementRepository.GetAnnouncementsByPage(p, c);
|
||||
}
|
||||
public bool CreateAnnouncement(string title, string description, User author, DateTime publishDate, bool isImportant, bool isSticky)
|
||||
{
|
||||
return announcementRepository.CreateAnnouncement(title, description, author, publishDate, isImportant, isSticky);
|
||||
}
|
||||
public bool UpdateAnnouncement(int id, string title, string description, bool isImportant, bool isSticky)
|
||||
{
|
||||
return announcementRepository.UpdateAnnouncement(id, title, description, isImportant, isSticky);
|
||||
}
|
||||
public bool DeleteAnnouncement(int id)
|
||||
{
|
||||
return announcementRepository.DeleteAnnouncement(id);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user