コード例 #1
0
 public async Task <IEnumerable <TEntity> > GetAllAsync()
 {
     using (var db = new DpContext())
     {
         return(await db.Set <TEntity>().ToListAsync());
     }
 }
コード例 #2
0
 public async Task <TEntity> GetByIdAsync(int id)
 {
     using (var db = new DpContext())
     {
         return(await db.Set <TEntity>().FindAsync(id));
     }
 }
コード例 #3
0
 public async Task <IEnumerable <TEntity> > GetNotDeletedAsync()
 {
     using (var db = new DpContext())
     {
         return(await db.Set <TEntity>().Where(t => !t.Deleted).ToListAsync());
     }
 }
コード例 #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();
            }
        }
コード例 #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);
            }
        }
コード例 #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;
 }
コード例 #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();
            }
        }
コード例 #8
0
 public HomeController(DpContext context)
 {
     _context = context;
 }
コード例 #9
0
 public ReportVideoService(DpContext context)
 {
     _context = context;
 }
コード例 #10
0
 public CategoryService(DpContext context)
 {
     _context = context;
 }
コード例 #11
0
 public BlogsController(DpContext context)
 {
     _context = context;
 }
コード例 #12
0
 public DetailVideoService(DpContext context)
 {
     _context = context;
 }
コード例 #13
0
 public ProcedureController(DpContext context)
 {
     cont = context;
 }
コード例 #14
0
 public FollowChannelService(DpContext context)
 {
     _contex = context;
 }
コード例 #15
0
 public VideoService(DpContext context)
 {
     _context = context;
 }
コード例 #16
0
 public LoginController(DpContext context)
 {
     _context = context;
 }
コード例 #17
0
 public BinhLuansController(DpContext context)
 {
     _context = context;
 }
コード例 #18
0
 public PlayListService(DpContext context)
 {
     _context = context;
 }
コード例 #19
0
 public NotificationService(DpContext context)
 {
     _context = context;
 }
コード例 #20
0
 public MessageService(DpContext context, IHostingEnvironment environment)
 {
     _context    = context;
     _enviroment = environment;
     PathXML     = _enviroment.WebRootPath + "\\Client\\fileXMLMessage\\xmlMessage.xml";
 }
コード例 #21
0
 public LoaisController(DpContext context)
 {
     _context = context;
 }
コード例 #22
0
 public VideoWatchedService(DpContext context)
 {
     _context = context;
 }
コード例 #23
0
 public TaiKhoansController(DpContext context)
 {
     _context = context;
 }
コード例 #24
0
 public CauHoisController(DpContext context)
 {
     _context = context;
 }
コード例 #25
0
 public CommentService(DpContext context)
 {
     _context = context;
 }