using Demo.Data.RemoteData.RemoteDataBase.DAO; using Microsoft.EntityFrameworkCore; using System.Collections.Generic; using System.Linq; namespace Demo.Data.Repository { public class SQLGroupRepositoryImpl : IGroupRepository { private readonly DbContext _context; public SQLGroupRepositoryImpl(DbContext context) { _context = context; } public IEnumerable GetAllGroups() { return _context.Set().ToList(); } public void AddGroup(Group group) { _context.Set().Add(group); _context.SaveChanges(); } public void UpdateGroupName(int id, string name) { var group = _context.Set().Find(id); if (group != null) { group.Name = name; _context.SaveChanges(); } } public void DeleteGroup(int id) { var group = _context.Set().Find(id); if (group != null) { _context.Set().Remove(group); _context.SaveChanges(); } } } }