Пример #1
0
 public bool Update(Post entity)
 {
     try
     {
         var post = _posts.First(e => e.Id == entity.Id);
         post.Body = entity.Body;
         post.Topic = entity.Topic;
         _dataContext.SubmitChanges();
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }
Пример #2
0
 public int Create(Post entity)
 {
     _posts.InsertOnSubmit(entity);
     _dataContext.SubmitChanges();
     return entity.Id;
 }