public async Task <IEnumerable <TEntity> > GetAllAsync() { using (var db = new DpContext()) { return(await db.Set <TEntity>().ToListAsync()); } }
public async Task <TEntity> GetByIdAsync(int id) { using (var db = new DpContext()) { return(await db.Set <TEntity>().FindAsync(id)); } }
public async Task <IEnumerable <TEntity> > GetNotDeletedAsync() { using (var db = new DpContext()) { return(await db.Set <TEntity>().Where(t => !t.Deleted).ToListAsync()); } }
public async Task DeleteAsync(int id) { using (var db = new DpContext()) { var entity = await db.TaskItems.FindAsync(id); entity.Deleted = true; await db.SaveChangesAsync(); } }
public async Task <int> CreateAsync(TEntity entity) { using (var db = new DpContext()) { db.Set <TEntity>().Add(entity); await db.SaveChangesAsync(); return(entity.Id); } }
public UserService(UserManager <AppUser> userManager, SignInManager <AppUser> signInManager, DpContext context, RoleManager <AppRole> role, IConfiguration config, IMessageService messageService, INotificationService notificationService) { _userManager = userManager; _signInManager = signInManager; _context = context; _roleManager = role; _config = config; _messageService = messageService; _notificationService = notificationService; }
public async Task UpdateAsync(TEntity entity) { using (var db = new DpContext()) { entity.ModifiedDateTime = DateTimeOffset.UtcNow; db.Set <TEntity>().Attach(entity); db.Entry(entity).State = EntityState.Modified; await db.SaveChangesAsync(); } }
public HomeController(DpContext context) { _context = context; }
public ReportVideoService(DpContext context) { _context = context; }
public CategoryService(DpContext context) { _context = context; }
public BlogsController(DpContext context) { _context = context; }
public DetailVideoService(DpContext context) { _context = context; }
public ProcedureController(DpContext context) { cont = context; }
public FollowChannelService(DpContext context) { _contex = context; }
public VideoService(DpContext context) { _context = context; }
public LoginController(DpContext context) { _context = context; }
public BinhLuansController(DpContext context) { _context = context; }
public PlayListService(DpContext context) { _context = context; }
public NotificationService(DpContext context) { _context = context; }
public MessageService(DpContext context, IHostingEnvironment environment) { _context = context; _enviroment = environment; PathXML = _enviroment.WebRootPath + "\\Client\\fileXMLMessage\\xmlMessage.xml"; }
public LoaisController(DpContext context) { _context = context; }
public VideoWatchedService(DpContext context) { _context = context; }
public TaiKhoansController(DpContext context) { _context = context; }
public CauHoisController(DpContext context) { _context = context; }
public CommentService(DpContext context) { _context = context; }