Exemple #1
0
 public async Task <IEnumerable <TEntity> > GetAllAsync()
 {
     using (var db = new DpContext())
     {
         return(await db.Set <TEntity>().ToListAsync());
     }
 }
Exemple #2
0
 public async Task <TEntity> GetByIdAsync(int id)
 {
     using (var db = new DpContext())
     {
         return(await db.Set <TEntity>().FindAsync(id));
     }
 }
Exemple #3
0
 public async Task <IEnumerable <TEntity> > GetNotDeletedAsync()
 {
     using (var db = new DpContext())
     {
         return(await db.Set <TEntity>().Where(t => !t.Deleted).ToListAsync());
     }
 }
Exemple #4
0
        public async Task DeleteAsync(int id)
        {
            using (var db = new DpContext())
            {
                var entity = await db.TaskItems.FindAsync(id);

                entity.Deleted = true;
                await db.SaveChangesAsync();
            }
        }
Exemple #5
0
        public async Task <int> CreateAsync(TEntity entity)
        {
            using (var db = new DpContext())
            {
                db.Set <TEntity>().Add(entity);
                await db.SaveChangesAsync();

                return(entity.Id);
            }
        }
Exemple #6
0
 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;
 }
Exemple #7
0
        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;
 }
Exemple #9
0
 public ReportVideoService(DpContext context)
 {
     _context = context;
 }
Exemple #10
0
 public CategoryService(DpContext context)
 {
     _context = context;
 }
 public BlogsController(DpContext context)
 {
     _context = context;
 }
Exemple #12
0
 public DetailVideoService(DpContext context)
 {
     _context = context;
 }
 public ProcedureController(DpContext context)
 {
     cont = context;
 }
Exemple #14
0
 public FollowChannelService(DpContext context)
 {
     _contex = context;
 }
Exemple #15
0
 public VideoService(DpContext context)
 {
     _context = context;
 }
 public LoginController(DpContext context)
 {
     _context = context;
 }
Exemple #17
0
 public BinhLuansController(DpContext context)
 {
     _context = context;
 }
 public PlayListService(DpContext context)
 {
     _context = context;
 }
Exemple #19
0
 public NotificationService(DpContext context)
 {
     _context = context;
 }
Exemple #20
0
 public MessageService(DpContext context, IHostingEnvironment environment)
 {
     _context    = context;
     _enviroment = environment;
     PathXML     = _enviroment.WebRootPath + "\\Client\\fileXMLMessage\\xmlMessage.xml";
 }
Exemple #21
0
 public LoaisController(DpContext context)
 {
     _context = context;
 }
Exemple #22
0
 public VideoWatchedService(DpContext context)
 {
     _context = context;
 }
 public TaiKhoansController(DpContext context)
 {
     _context = context;
 }
Exemple #24
0
 public CauHoisController(DpContext context)
 {
     _context = context;
 }
 public CommentService(DpContext context)
 {
     _context = context;
 }