public virtual void UpdateFile(User user, Attachment a, String oldFilePath) { a.Created = DateTime.Now; a.update(); if (a.IsImage) { Img.DeleteImgAndThumb(oldFilePath); } else { Img.DeleteFile(oldFilePath); } ForumTopicService topicService = new ForumTopicService(); ForumPost post = ForumPost.findById(a.PostId); topicService.UpdateLastEditInfo(user, post); }
public virtual Result Create( Attachment a, User user, IMember owner ) { a.OwnerId = owner.Id; a.OwnerType = owner.GetType().FullName; a.OwnerUrl = owner.Url; a.Creator = user; a.CreatorUrl = user.Url; a.Guid = Guid.NewGuid().ToString(); ForumTopicService topicService = new ForumTopicService(); ForumPost post = topicService.GetPostByTopic( a.TopicId ); a.PostId = post.Id; Result result = db.insert( a ); refreshTopicCount( a ); topicService.UpdateLastEditInfo( user, post ); return result; }
public virtual Result Create(Attachment a, User user, IMember owner) { a.OwnerId = owner.Id; a.OwnerType = owner.GetType().FullName; a.OwnerUrl = owner.Url; a.Creator = user; a.CreatorUrl = user.Url; a.Guid = Guid.NewGuid().ToString(); ForumTopicService topicService = new ForumTopicService(); ForumPost post = topicService.GetPostByTopic(a.TopicId); a.PostId = post.Id; Result result = db.insert(a); refreshTopicCount(a); topicService.UpdateLastEditInfo(user, post); return(result); }
public virtual void UpdateFile( User user, Attachment a, String oldFilePath ) { a.Created = DateTime.Now; a.update(); if (a.IsImage) { Img.DeleteImgAndThumb( oldFilePath ); } else { Img.DeleteFile( oldFilePath ); } ForumTopicService topicService = new ForumTopicService(); ForumPost post = ForumPost.findById( a.PostId ); topicService.UpdateLastEditInfo( user, post ); }