public async Task <DashboardDb> CreateAsync(DashboardDb item)
        {
            var addedItem = _context.Dashboards.Add(item);
            await _context.SaveChangesAsync();

            return(addedItem);
        }
        public async Task <bool> DeleteAsync(DashboardDb DashboardDb)
        {
            if (DashboardDb == null)
            {
                return(false);
            }

            _context.Dashboards.Remove(DashboardDb);
            await _context.SaveChangesAsync();

            return(true);
        }
        public async Task <DashboardDb> UpdateAsync(DashboardDb item)
        {
            _context.Dashboards.Attach(item);
            var entry = _context.Entry(item);

            entry.State = EntityState.Modified;
            entry.Property(_ => _.Name).IsModified     = true;
            entry.Property(_ => _.Modified).IsModified = true;
            entry.Property(_ => _.Modifier).IsModified = true;

            await _context.SaveChangesAsync();

            return(item);
        }
示例#4
0
 public Handler(IAppContext appContext, DashboardDb db)
 {
     _appContext = appContext;
     _db         = db;
 }