/// <summary> /// 获取首页房屋的置顶展示 /// </summary> /// <returns></returns> public List <HouseTransferInfo> GetHomeHouseTopShow() { var topShows = new List <TopShow>(); var houses = new List <HouseTransferInfo>(); using (var content = new FxAggregateContext()) { topShows = content.TopShows.Where(r => r.ChannelCatagroy == (int)ChannelCatagroy.FxHouseTrasnfer).ToList(); } foreach (var item in topShows) { houses.Add(new HouseTransferInfo() { HouseTransferInfoId = item.InfoId, Price = item.Price, PublishTitle = item.Title, Pictures = new List <TransferPicture>() { new TransferPicture() { TransferPictureCatagroy = (int)PictureCatagroy.Head, ImageUrl = item.HeadPicture, } } }); } return(houses); }
/// <summary> /// 获取置顶信息 /// </summary> /// <param name="id">置顶id</param> /// <returns>置顶信息</returns> public TopShow GetById(int id) { using (var content = new FxAggregateContext()) { return(content.TopShows.Where(r => r.TopShowId == id).FirstOrDefault()); } }
public List<TopShow> GetAllTopShow() { using (var content = new FxAggregateContext()) { return content.TopShows.ToList(); } }
/// <summary> /// 添加收藏 /// </summary> /// <param name="favorite"></param> /// <returns></returns> public DomainResult AddFavorite(Entity.FxAggregate.Favorite favorite) { using (var context = new FxAggregateContext()) { var fav = GetFavorite(favorite.ChannelCatagroy, favorite.InfoId, favorite.UserAccount); if (fav != null) { return(new DomainResult(false) { ResultMsg = "您已对此帖子进行收藏了" }); } var info = aggregateInfoService.GetInfoByCatatgroyAndId(favorite.ChannelCatagroy, favorite.InfoId); if (info == null || aggregateInfoService.IsValid(info) == false) { return(new DomainResult(false) { ResultMsg = "您不能对此帖子进行收藏(可能已删除或者未发布)" }); } else { context.Favorites.Add(favorite); context.SaveChanges(); return(DomainResult.GetDefault()); } } }
/// <summary> /// 获取所有置顶信息 /// </summary> /// <returns></returns> public List <TopShow> GetAllTopShow() { using (var content = new FxAggregateContext()) { return(content.TopShows.ToList()); } }
/// <summary> /// 添加私信 /// </summary> /// <param name="message"></param> public void AddPrivateMessage(PrivateMessage message) { using (var content = new FxAggregateContext()) { content.PrivateMessages.Add(message); content.SaveChanges(); } }
/// <summary> /// 用户私信数量 /// </summary> /// <param name="email">帐号</param> /// <returns>私信数量</returns> public int PrivateMessageCount(string email) { using (var content = new FxAggregateContext()) { return content.PrivateMessages .Where(r => r.UserAccount == email).Count(); } }
/// <summary> /// 获取帐号下所有的收藏信息 /// </summary> /// <param name="accountUser">帐号</param> /// <returns>收藏信息列表</returns> public List <Favorite> GetFavorite(string accountUser) { using (var context = new FxAggregateContext()) { return(context.Favorites .Where(r => r.UserAccount == accountUser).ToList()); } }
public List<Favorite> GetFavorite(string accountUser) { using (var context = new FxAggregateContext()) { return context.Favorites .Where(r => r.UserAccount == accountUser).ToList(); } }
/// <summary> /// 用户私信数量 /// </summary> /// <param name="email">帐号</param> /// <returns>私信数量</returns> public int PrivateMessageCount(string email) { using (var content = new FxAggregateContext()) { return(content.PrivateMessages .Where(r => r.UserAccount == email).Count()); } }
/// <summary> /// 根据Id获取收藏信息 /// </summary> /// <param name="id"></param> /// <returns></returns> public Favorite GetById(int id) { using (var context = new FxAggregateContext()) { return(context.Favorites .Where(r => r.FavoriteId == id).FirstOrDefault()); } }
public Favorite GetById(int id) { using (var context = new FxAggregateContext()) { return context.Favorites .Where(r => r.FavoriteId == id).FirstOrDefault(); } }
/// <summary> /// 获取私信 /// </summary> /// <param name="email">用户帐号</param> /// <returns>私信</returns> public List <PrivateMessage> GetByUser(string email) { using (var content = new FxAggregateContext()) { var entitys = content.PrivateMessages .Where(r => r.UserAccount == email).ToList(); return(entitys); } }
/// <summary> /// 获取用户私信 /// </summary> /// <param name="id">私信Id</param> /// <returns>私信列表</returns> public PrivateMessage GetById(int id) { using (var content = new FxAggregateContext()) { var entity = content.PrivateMessages .Where(r => r.PrivateMessageId == id).FirstOrDefault(); return(entity); } }
/// <summary> /// 获取私信 /// </summary> /// <param name="email">用户帐号</param> /// <returns>私信</returns> public List<PrivateMessage> GetByUser(string email) { using (var content = new FxAggregateContext()) { var entitys = content.PrivateMessages .Where(r => r.UserAccount == email).ToList(); return entitys; } }
/// <summary> /// 获取用户私信 /// </summary> /// <param name="id">私信Id</param> /// <returns>私信列表</returns> public PrivateMessage GetById(int id) { using (var content = new FxAggregateContext()) { var entity = content.PrivateMessages .Where(r => r.PrivateMessageId == id).FirstOrDefault(); return entity; } }
/// <summary> /// 获取收藏信息 /// </summary> /// <param name="ChannelCatagroy">频道</param> /// <param name="infoId">帖子id</param> /// <param name="userAccount">用户帐号</param> /// <returns>收藏信息</returns> public Favorite GetFavorite(int ChannelCatagroy, int infoId, string userAccount) { using (var context = new FxAggregateContext()) { return(context.Favorites .Where(r => r.ChannelCatagroy == ChannelCatagroy && r.InfoId == infoId && r.UserAccount == userAccount).FirstOrDefault()); } }
public Favorite GetFavorite(int ChannelCatagroy, int infoId, string userAccount) { using (var context = new FxAggregateContext()) { return context.Favorites .Where(r => r.ChannelCatagroy == ChannelCatagroy && r.InfoId == infoId && r.UserAccount == userAccount).FirstOrDefault(); } }
public void TopShow(TopShow entity) { if (!IsExist(entity)) { using (var content = new FxAggregateContext()) { content.TopShows.Add(entity); content.SaveChanges(); } } }
/// <summary> /// 置顶相关帖子 /// </summary> /// <param name="entity">置顶信息</param> public void TopShow(TopShow entity) { if (!IsExist(entity)) { using (var content = new FxAggregateContext()) { content.TopShows.Add(entity); content.SaveChanges(); } } }
/// <summary> /// 删除私信 /// </summary> /// <param name="message"></param> public void RemovePrivateMessage(PrivateMessage message) { using (var content = new FxAggregateContext()) { var entity = content.PrivateMessages .Where(r => r.PrivateMessageId == message.PrivateMessageId).FirstOrDefault(); if (entity != null) { content.PrivateMessages.Remove(entity); content.SaveChanges(); } } }
/// <summary> /// 获取车辆求购置顶信息 用于具体频道的展示 /// </summary> /// <returns>车辆信息列表</returns> public List <CarBuyInfo> GetCarBuyTopShow() { var topShows = new List <TopShow>(); var cars = new List <CarBuyInfo>(); using (var content = new FxAggregateContext()) { topShows = content.TopShows.Where(r => r.ChannelCatagroy == (int)ChannelCatagroy.FxCarBuy).ToList(); } foreach (var item in topShows) { cars.Add(buyCarService.Get(item.InfoId)); } return(cars); }
/// <summary> /// 获取物品求购置顶信息 用于具体频道的展示 /// </summary> /// <returns>物品信息列表</returns> public List <GoodsBuyInfo> GetGoodsBuyTopShow() { var topShows = new List <TopShow>(); var goods = new List <GoodsBuyInfo>(); using (var content = new FxAggregateContext()) { topShows = content.TopShows.Where(r => r.ChannelCatagroy == (int)ChannelCatagroy.FxGoodsBuy).ToList(); } foreach (var item in topShows) { goods.Add(this.buyGoodsService.Get(item.InfoId)); } return(goods); }
/// <summary> /// 获取房屋求购置顶信息 用于具体频道的展示 /// </summary> /// <returns>房屋信息列表</returns> public List <HouseBuyInfo> GetHouseBuyTopShow() { var topShows = new List <TopShow>(); var houses = new List <HouseBuyInfo>(); using (var content = new FxAggregateContext()) { topShows = content.TopShows.Where(r => r.ChannelCatagroy == (int)ChannelCatagroy.FxHouseBuy).ToList(); } foreach (var item in topShows) { houses.Add(this.buyHouseService.Get(item.InfoId)); } return(houses); }
/// <summary> /// 取消置顶 /// </summary> /// <param name="entity"></param> public void TopShowCancel(TopShow entity) { if (IsExist(entity)) { using (var content = new FxAggregateContext()) { entity = content.TopShows .Where(r => r.TopShowId == entity.TopShowId) .FirstOrDefault(); if (entity != null) { content.TopShows.Remove(entity); content.SaveChanges(); } } } }
public DomainResult DeleteFavorite(Entity.FxAggregate.Favorite favorite) { using (var context = new FxAggregateContext()) { favorite = context.Favorites.Where(r => r.FavoriteId == favorite.FavoriteId).FirstOrDefault(); if (favorite != null) { context.Favorites.Remove(favorite); context.SaveChanges(); return DomainResult.GetDefault(); } else { return new DomainResult(false) { ResultMsg = "收藏失败,此帖子可能已被删除" }; } } }
/// <summary> /// 取消置顶信息 /// </summary> /// <param name="entity">置顶信息</param> public void TopShowCancel(TopShow entity) { if (IsExist(entity)) { using (var content = new FxAggregateContext()) { entity = content.TopShows .Where(r => r.TopShowId == entity.TopShowId) .FirstOrDefault(); if (entity != null) { content.TopShows.Remove(entity); content.SaveChanges(); } } } }
/// <summary> /// 删除收藏 /// </summary> /// <param name="favorite"></param> /// <returns></returns> public DomainResult DeleteFavorite(Entity.FxAggregate.Favorite favorite) { using (var context = new FxAggregateContext()) { favorite = context.Favorites.Where(r => r.FavoriteId == favorite.FavoriteId).FirstOrDefault(); if (favorite != null) { context.Favorites.Remove(favorite); context.SaveChanges(); return(DomainResult.GetDefault()); } else { return(new DomainResult(false) { ResultMsg = "收藏失败,此帖子可能已被删除" }); } } }
public DomainResult AddFavorite(Entity.FxAggregate.Favorite favorite) { using (var context = new FxAggregateContext()) { var fav = GetFavorite(favorite.ChannelCatagroy, favorite.InfoId, favorite.UserAccount); if (fav != null) { return new DomainResult(false) { ResultMsg = "您已对此帖子进行收藏了" }; } var info = aggregateInfoService.GetInfoByCatatgroyAndId(favorite.ChannelCatagroy, favorite.InfoId); if (info == null || aggregateInfoService.IsValid(info) == false) { return new DomainResult(false) { ResultMsg = "您不能对此帖子进行收藏(可能已删除或者未发布)" }; } else { context.Favorites.Add(favorite); context.SaveChanges(); return DomainResult.GetDefault(); } } }
public List<GoodsBuyInfo> GetGoodsBuyTopShow() { var topShows = new List<TopShow>(); var goods = new List<GoodsBuyInfo>(); using (var content = new FxAggregateContext()) { topShows = content.TopShows.Where(r => r.ChannelCatagroy == (int)ChannelCatagroy.FxGoodsBuy).ToList(); } foreach (var item in topShows) { goods.Add(this.buyGoodsService.Get(item.InfoId)); } return goods; }
public List<HouseTransferInfo> GetHomeHouseTopShow() { var topShows = new List<TopShow>(); var houses = new List<HouseTransferInfo>(); using (var content = new FxAggregateContext()) { topShows = content.TopShows.Where(r => r.ChannelCatagroy == (int)ChannelCatagroy.FxHouseTrasnfer).ToList(); } foreach (var item in topShows) { houses.Add(new HouseTransferInfo() { HouseTransferInfoId = item.InfoId, Price = item.Price, PublishTitle = item.Title, Pictures = new List<TransferPicture>() { new TransferPicture(){ TransferPictureCatagroy= (int)PictureCatagroy.Head, ImageUrl=item.HeadPicture, } } }); } return houses; }
public List<HouseBuyInfo> GetHouseBuyTopShow() { var topShows = new List<TopShow>(); var houses = new List<HouseBuyInfo>(); using (var content = new FxAggregateContext()) { topShows = content.TopShows.Where(r => r.ChannelCatagroy == (int)ChannelCatagroy.FxHouseBuy).ToList(); } foreach (var item in topShows) { houses.Add(this.buyHouseService.Get(item.InfoId)); } return houses; }
public List<CarBuyInfo> GetCarBuyTopShow() { var topShows = new List<TopShow>(); var cars = new List<CarBuyInfo>(); using (var content = new FxAggregateContext()) { topShows = content.TopShows.Where(r => r.ChannelCatagroy == (int)ChannelCatagroy.FxCarBuy).ToList(); } foreach (var item in topShows) { cars.Add(buyCarService.Get(item.InfoId)); } return cars; }
public TopShow GetById(int id) { using (var content = new FxAggregateContext()) { return content.TopShows.Where(r => r.TopShowId == id).FirstOrDefault(); } }