School Commit Init

This commit is contained in:
2024-08-31 12:07:21 +03:00
commit 0b130ee18c
2801 changed files with 4720552 additions and 0 deletions
@@ -0,0 +1,48 @@
using District3API.domain;
using District3API.DataBaseContext;
using District3API.RepoInterfaces;
namespace District3API.Repos
{
public class AccountRepository : IRepoInterface<Account>
{
private readonly DataContext _context;
public AccountRepository(DataContext context)
{
_context = context;
}
public void Add(Account item)
{
_context.Account.Add(item);
_context.SaveChanges();
}
public void Delete(int id)
{
var account = _context.Account.Find(id);
if (account != null)
{
_context.Account.Remove(account);
_context.SaveChanges();
}
}
public ICollection<Account> GetAll()
{
return _context.Account.ToList();
}
public Account GetById(int id)
{
return _context.Account.Find(id);
}
public void Update(Account item)
{
_context.Account.Update(item);
_context.SaveChanges();
}
}
}
@@ -0,0 +1,48 @@
using District3API.domain;
using District3API.DataBaseContext;
using District3API.RepoInterfaces;
namespace District3API.Repos
{
public class BlockedProfileRepository : IRepoInterface<BlockedProfile>
{
private readonly DataContext _context;
public BlockedProfileRepository(DataContext context)
{
_context = context;
}
public void Add(BlockedProfile item)
{
_context.BlockedProfile.Add(item);
_context.SaveChanges();
}
public void Delete(int id)
{
var blockedProfile = _context.BlockedProfile.Find(id);
if (blockedProfile != null)
{
_context.BlockedProfile.Remove(blockedProfile);
_context.SaveChanges();
}
}
public ICollection<BlockedProfile> GetAll()
{
return _context.BlockedProfile.ToList();
}
public BlockedProfile GetById(int id)
{
return _context.BlockedProfile.Find(id);
}
public void Update(BlockedProfile item)
{
_context.BlockedProfile.Update(item);
_context.SaveChanges();
}
}
}
@@ -0,0 +1,48 @@
using District3API.domain;
using District3API.DataBaseContext;
using District3API.RepoInterfaces;
namespace District3API.Repos
{
public class CloseFriendsProfileRepository : IRepoInterface<CloseFriendProfile>
{
private readonly DataContext _context;
public CloseFriendsProfileRepository(DataContext context)
{
_context = context;
}
public void Add(CloseFriendProfile item)
{
_context.CloseFriendProfile.Add(item);
_context.SaveChanges();
}
public void Delete(int id)
{
var closeFriendProfile = _context.CloseFriendProfile.Find(id);
if (closeFriendProfile != null)
{
_context.CloseFriendProfile.Remove(closeFriendProfile);
_context.SaveChanges();
}
}
public ICollection<CloseFriendProfile> GetAll()
{
return _context.CloseFriendProfile.ToList();
}
public CloseFriendProfile GetById(int id)
{
return _context.CloseFriendProfile.Find(id);
}
public void Update(CloseFriendProfile item)
{
_context.CloseFriendProfile.Update(item);
_context.SaveChanges();
}
}
}
@@ -0,0 +1,48 @@
using District3API.domain;
using District3API.DataBaseContext;
using District3API.RepoInterfaces;
namespace District3API.Repos
{
public class FancierProfileRepository : IRepoInterface<FancierProfile>
{
private readonly DataContext _context;
public FancierProfileRepository(DataContext context)
{
_context = context;
}
public void Add(FancierProfile item)
{
_context.FancierProfile.Add(item);
_context.SaveChanges();
}
public void Delete(int id)
{
var fancierProfile = _context.FancierProfile.Find(id);
if (fancierProfile != null)
{
_context.FancierProfile.Remove(fancierProfile);
_context.SaveChanges();
}
}
public ICollection<FancierProfile> GetAll()
{
return _context.FancierProfile.ToList();
}
public FancierProfile GetById(int id)
{
return _context.FancierProfile.Find(id);
}
public void Update(FancierProfile item)
{
_context.FancierProfile.Update(item);
_context.SaveChanges();
}
}
}
@@ -0,0 +1,48 @@
using District3API.domain;
using District3API.DataBaseContext;
using District3API.RepoInterfaces;
namespace District3API.Repos
{
public class GroupRepository : IRepoInterface<Group>
{
private readonly DataContext _context;
public GroupRepository(DataContext context)
{
_context = context;
}
public void Add(Group item)
{
_context.Group.Add(item);
_context.SaveChanges();
}
public void Delete(int id)
{
var group = _context.Group.Find(id);
if (group != null)
{
_context.Group.Remove(group);
_context.SaveChanges();
}
}
public ICollection<Group> GetAll()
{
return _context.Group.ToList();
}
public Group GetById(int id)
{
return _context.Group.Find(id);
}
public void Update(Group item)
{
_context.Group.Update(item);
_context.SaveChanges();
}
}
}
@@ -0,0 +1,48 @@
using District3API.domain;
using District3API.DataBaseContext;
using District3API.RepoInterfaces;
namespace District3API.Repos
{
public class HighlightRepository : IRepoInterface<Highlight>
{
private readonly DataContext _context;
public HighlightRepository(DataContext context)
{
_context = context;
}
public void Add(Highlight item)
{
_context.Highlight.Add(item);
_context.SaveChanges();
}
public void Delete(int id)
{
var highlight = _context.Highlight.Find(id);
if (highlight != null)
{
_context.Highlight.Remove(highlight);
_context.SaveChanges();
}
}
public ICollection<Highlight> GetAll()
{
return _context.Highlight.ToList();
}
public Highlight GetById(int id)
{
return _context.Highlight.Find(id);
}
public void Update(Highlight item)
{
_context.Highlight.Update(item);
_context.SaveChanges();
}
}
}
@@ -0,0 +1,48 @@
using District3API.domain;
using District3API.DataBaseContext;
using District3API.RepoInterfaces;
namespace District3API.Repos
{
public class PostRepository : IRepoInterface<Post>
{
private readonly DataContext _context;
public PostRepository(DataContext context)
{
_context = context;
}
public void Add(Post item)
{
_context.Post.Add(item);
_context.SaveChanges();
}
public void Delete(int id)
{
var post = _context.Post.Find(id);
if (post != null)
{
_context.Post.Remove(post);
_context.SaveChanges();
}
}
public ICollection<Post> GetAll()
{
return _context.Post.ToList();
}
public Post GetById(int id)
{
return _context.Post.Find(id);
}
public void Update(Post item)
{
_context.Post.Update(item);
_context.SaveChanges();
}
}
}
@@ -0,0 +1,48 @@
using District3API.domain;
using District3API.DataBaseContext;
using District3API.RepoInterfaces;
namespace District3API.Repos
{
public class UserRepository : IRepoInterface<User>
{
private readonly DataContext _context;
public UserRepository(DataContext context)
{
_context = context;
}
public void Add(User item)
{
_context.User.Add(item);
_context.SaveChanges();
}
public void Delete(int id)
{
var user = _context.User.Find(id);
if (user != null)
{
_context.User.Remove(user);
_context.SaveChanges();
}
}
public ICollection<User> GetAll()
{
return _context.User.ToList();
}
public User GetById(int id)
{
return _context.User.Find(id);
}
public void Update(User item)
{
_context.User.Update(item);
_context.SaveChanges();
}
}
}