public void UpdateSequence(long vshopId, int?sequence) { VShopExtendInfo vShopExtendInfo = this.context.VShopExtendInfo.FindBy((VShopExtendInfo item) => item.VShopId == vshopId && (int)item.Type == 2).FirstOrDefault(); vShopExtendInfo.Sequence = sequence; this.context.SaveChanges(); }
public void SetTopShop(long vshopId) { this.GetVshopById(vshopId); if (( from a in this.context.VShopExtendInfo where (int)a.Type == 1 select a).Count() == 1) { VShopExtendInfo vShopExtendInfo = ( from a in this.context.VShopExtendInfo where (int)a.Type == 1 select a).FirstOrDefault(); this.context.VShopExtendInfo.Remove(vShopExtendInfo); } if (( from a in this.context.VShopExtendInfo where a.VShopId == vshopId select a).Count() >= 1) { this.context.VShopExtendInfo.OrderBy((VShopExtendInfo item) => item.VShopId == vshopId); } DbSet <VShopExtendInfo> vShopExtendInfos = this.context.VShopExtendInfo; VShopExtendInfo vShopExtendInfo1 = new VShopExtendInfo() { VShopId = vshopId, Type = VShopExtendInfo.VShopExtendType.TopShow, AddTime = DateTime.Now }; vShopExtendInfos.Add(vShopExtendInfo1); this.context.SaveChanges(); }
public void ReplaceTopShop(long oldVShopId, long newTopVShopId) { VShopExtendInfo now = this.context.VShopExtendInfo.FindBy((VShopExtendInfo item) => item.VShopId == oldVShopId && (int)item.Type == 1).FirstOrDefault(); now.VShopId = newTopVShopId; now.AddTime = DateTime.Now; this.context.SaveChanges(); }
public void AuditThrough(long vshopId) { DbSet <VShopExtendInfo> vShopExtendInfo = this.context.VShopExtendInfo; VShopExtendInfo vShopExtendInfo1 = new VShopExtendInfo() { Sequence = new int?(1), VShopId = vshopId, AddTime = DateTime.Now, Type = VShopExtendInfo.VShopExtendType.HotVShop }; vShopExtendInfo.Add(vShopExtendInfo1); this.context.SaveChanges(); }
public void SetHotShop(long vshopId) { if (this.GetAllVshop().ToList().Where((VShopInfo a) => { if (a.VShopExtendInfo == null) { return(false); } return(a.VShopExtendInfo.Any((VShopExtendInfo item) => item.Type == VShopExtendInfo.VShopExtendType.HotVShop)); }).Count() >= 60) { throw new HimallException("热门微店最多为60个"); } if (( from a in this.GetVshopById(vshopId).VShopExtendInfo where a.Type == VShopExtendInfo.VShopExtendType.HotVShop select a).Count() >= 1) { throw new HimallException("该微店已经是热门微店"); } if (( from a in this.context.VShopExtendInfo where a.VShopId == vshopId select a).Count() >= 1) { this.context.VShopExtendInfo.OrderBy((VShopExtendInfo item) => item.VShopId == vshopId); } DbSet <VShopExtendInfo> vShopExtendInfo = this.context.VShopExtendInfo; VShopExtendInfo vShopExtendInfo1 = new VShopExtendInfo() { VShopId = vshopId, AddTime = DateTime.Now, Type = VShopExtendInfo.VShopExtendType.HotVShop, Sequence = new int?(1) }; vShopExtendInfo.Add(vShopExtendInfo1); this.context.SaveChanges(); }