35 lines
839 B
C#
35 lines
839 B
C#
using data.DAO;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace data.Repository
|
|
{
|
|
public class SQLGroupRepository : IGroupRepository
|
|
{
|
|
public readonly RemoteDatabaseContext dbContext;
|
|
public SQLGroupRepository(RemoteDatabaseContext remoteDatabaseContext)
|
|
{
|
|
dbContext = remoteDatabaseContext;
|
|
}
|
|
public bool addGroup(GroupDAO group)
|
|
{
|
|
try
|
|
{
|
|
dbContext.groups.Add(group);
|
|
return dbContext.SaveChanges() > 1;
|
|
}
|
|
catch (Exception ex) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public IEnumerable<GroupDAO> getAllGroup()
|
|
{
|
|
return dbContext.groups.ToList();
|
|
}
|
|
}
|
|
}
|