public void Edit(Article article)
        {
            var currentArticle = db.Set <Article>().Find(article.ArticleId);

            currentArticle.Name          = article.Name;
            currentArticle.TextOfArticle = article.TextOfArticle;

            db.Entry(currentArticle).State = EntityState.Modified;
            db.SaveChanges();
        }
示例#2
0
 public async Task <T> GetByIdAsync(int id)
 {
     return(await _context.Set <T>().FindAsync(id));
 }