public async Task DelPage(int id) { var news = await _dbContext.Pages.AsNoTracking().SingleOrDefaultAsync(m => m.PageID == id); if (news != null) { _dbContext.Pages.Remove(news); await _dbContext.SaveChangesAsync(); } }
public async Task <Pages> GetPage(int id, int language) { var page = await _dbContext.Pages.AsNoTracking().FirstOrDefaultAsync(p => p.ColumnID == id && p.Language == language); if (page != null) { page.Hit = page.Hit + 1; _dbContext.Update(page); await _dbContext.SaveChangesAsync(); return(page); } else { return(null); } }