public static UserCenterListModel Create(Metadata m, PKS_USERBEHAVIOR p) { return(new UserCenterListModel { Id = p.Id, FavoriteFlag = p.FAVORITEFLAG, FavoriteDate = p.FAVORITEDATE.ToStandardString(), IIID = p.IIID, DownLoadCount = p.DOWNLOADCOUNT, DownLoadDate = p.DOWNLOADDATE.ToStandardString(), Title = m.Title, Author = m.Author, DataId = m.DataId, ShowType = m.ShowType.ToEnum <IndexShowType>(true), IndexedDate = m.IndexedDate.ToStandardString() }); }
/// <summary> /// 添加下载记录 /// </summary> public PKS_USERBEHAVIOR AddDownLoad(int userId, string IIID) { var behavior = _userBehavior.Find(f => f.USERID == userId && f.IIID == IIID); if (behavior != null) { behavior.DOWNLOADCOUNT = behavior.DOWNLOADCOUNT + 1; behavior.DOWNLOADDATE = DateTime.Now; _userBehavior.Update(behavior); return(behavior); } behavior = new PKS_USERBEHAVIOR { IIID = IIID, USERID = userId, DOWNLOADCOUNT = 0, DOWNLOADDATE = DateTime.Now }; _userBehavior.Add(behavior); return(behavior); }
/// <summary> /// 添加收藏 /// </summary> public PKS_USERBEHAVIOR AddFavorite(int userId, string IIID, int favoritecatalogId) { var behavior = _userBehavior.Find(f => f.USERID == userId && f.IIID == IIID); if (behavior != null) { behavior.FAVORITEFLAG = true; behavior.FAVORITEDATE = DateTime.Now; behavior.FAVORITECATALOGID = favoritecatalogId; _userBehavior.Update(behavior); return(behavior); } behavior = new PKS_USERBEHAVIOR { IIID = IIID, USERID = userId, FAVORITECATALOGID = favoritecatalogId, FAVORITEFLAG = true, FAVORITEDATE = DateTime.Now, DOWNLOADCOUNT = 0 }; _userBehavior.Add(behavior); return(behavior); }