Пример #1
0
 public void Create(DalTheme entity)
 {
     var theme = new Theme()
     {
         Id = entity.Id,
         Name = entity.Name,
         DatePublication = entity.DatePublication,
         CountViews = entity.CountViews,
         CreatorId = entity.CreatorId,
         SectionId = entity.SectionId,
         Content = entity.Content
        
     };
     context.Set<Theme>().Add(theme);
 }
Пример #2
0
 public void Delete(DalTheme entity)
 {
     var theme = context.Set<Theme>().Where(th => th.Id == entity.Id).FirstOrDefault();
     if (theme != null)
     {
         context.Set<Theme>().Remove(theme);
     }
     
 }
Пример #3
0
 public void Update(DalTheme entity)
 {
     var theme = context.Set<Theme>().Where(th => th.Id == entity.Id).FirstOrDefault();
     if (theme != null)
     {
         theme.Name = entity.Name;
         theme.DatePublication = entity.DatePublication;
         theme.CountViews = entity.CountViews;
         theme.CreatorId = entity.CreatorId;
         theme.SectionId = entity.SectionId;
         theme.Content = entity.Content;
     }
 }