本文整理汇总了C#中PhotoPost.update方法的典型用法代码示例。如果您正苦于以下问题:C# PhotoPost.update方法的具体用法?C# PhotoPost.update怎么用?C# PhotoPost.update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhotoPost
的用法示例。
在下文中一共展示了PhotoPost.update方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UnLike
public void UnLike( User user, PhotoPost post )
{
PhotoLike p = this.GetOne( user.Id, post.Id );
p.delete();
post.Likes = PhotoLike.count( "PostId=" + post.Id );
post.update();
user.Likes = PhotoLike.count( "UserId=" + user.Id );
user.update( "Likes" );
}
示例2: Like
public void Like( User user, PhotoPost post )
{
PhotoLike x = new PhotoLike();
x.Post = post;
x.User = user;
x.insert();
post.Likes = PhotoLike.count( "PostId=" + post.Id );
post.update();
user.Likes = PhotoLike.count( "UserId=" + user.Id );
user.update( "Likes" );
}
示例3: updatePhotoSize
// 保存图片大小等信息
private void updatePhotoSize( PhotoPost post )
{
String photoPath = post.DataUrl;
if (strUtil.IsNullOrEmpty( photoPath )) return;
if (photoPath.ToLower().StartsWith( "http://" )) return;
if (photoPath.StartsWith( "/" )) return;
Dictionary<String, PhotoInfo> dic = new Dictionary<String, PhotoInfo>();
foreach (KeyValuePair<String, ThumbInfo> kv in ThumbConfig.GetPhotoConfig()) {
String xpath = Img.GetThumbPath( strUtil.Join( sys.Path.DiskPhoto, photoPath ), kv.Key );
String thumbPath = PathHelper.Map( xpath );
Size size = Img.GetPhotoSize( thumbPath );
dic.Add( kv.Key, new PhotoInfo { Width=size.Width, Height=size.Height } );
}
String str = ObjectContext.Create<PhotoInfoHelper>().ConvertString( dic );
if (strUtil.IsNullOrEmpty( str )) return;
post.SizeInfo = str;
post.update();
}
示例4: SavePin
public void SavePin( PhotoPost x, PhotoPost photo, String tagList )
{
populatePostInfo( photo, x );
photo.insert();
photo.Tag.Save( tagList );
// TODO 动态消息
x.Pins = PhotoPost.count( "RootId=" + x.Id + " or ParentId=" + x.Id );
x.update( "Pins" );
User user = photo.Creator;
user.Pins = PhotoPost.count( "OwnerId=" + user.Id );
user.update( "Pins" );
}
示例5: updatePhotoSize
// 保存图片大小等信息
private void updatePhotoSize( PhotoPost post )
{
String photoPath = post.DataUrl;
Dictionary<String, PhotoInfo> dic = new Dictionary<String, PhotoInfo>();
foreach (KeyValuePair<String, ThumbInfo> kv in ThumbConfig.GetPhotoConfig()) {
String xpath = Img.GetThumbPath( strUtil.Join( sys.Path.DiskPhoto, photoPath ), kv.Key );
String thumbPath = PathHelper.Map( xpath );
if (file.Exists( thumbPath ) == false) continue;
Size size = Img.GetPhotoSize( thumbPath );
dic.Add( kv.Key, new PhotoInfo { Width = size.Width, Height = size.Height } );
}
String str = ObjectContext.Create<PhotoInfoHelper>().ConvertString( dic );
if (strUtil.IsNullOrEmpty( str )) return;
post.SizeInfo = str;
post.update();
log( "重新统计成功="+post.Id+",path="+photoPath );
}