public ActionResult AddHomeFloorDetail(long id = 0L) { string str; string str1; HomeFloorDetail homeFloorDetail = new HomeFloorDetail() { Id = 0 }; HomeFloorInfo homeFloor = ServiceHelper.Create <IFloorService>().GetHomeFloor(id); if (homeFloor != null) { homeFloorDetail.Id = homeFloor.Id; homeFloorDetail.TextLinks = from item in homeFloor.FloorTopicInfo where item.TopicType == Position.Top select new HomeFloorDetail.TextLink() { Id = item.Id, Name = item.TopicName, Url = item.Url }; homeFloorDetail.ProductLinks = from item in homeFloor.FloorTopicInfo where item.TopicType != Position.Top select new HomeFloorDetail.TextLink() { Id = (long)item.TopicType, Name = item.Url, Url = item.TopicImage } into i orderby i.Id select i; } else { homeFloor = new HomeFloorInfo(); List <HomeFloorDetail.TextLink> textLinks = new List <HomeFloorDetail.TextLink>(); for (int num = 0; num < 10; num++) { HomeFloorDetail.TextLink textLink = new HomeFloorDetail.TextLink() { Id = num, Name = "", Url = "" }; textLinks.Add(textLink); } homeFloorDetail.ProductLinks = textLinks; } dynamic viewBag = base.ViewBag; str = (homeFloor == null ? "" : homeFloor.FloorName); viewBag.FloorName = str; dynamic obj = base.ViewBag; str1 = (homeFloor == null ? "" : homeFloor.SubName); obj.SubName = str1; return(View(homeFloorDetail)); }
public ActionResult AddHomeFloorDetail2(long id = 0L) { string str; string str1; HomeFloorDetail homeFloorDetail = new HomeFloorDetail() { Id = 0 }; HomeFloorInfo homeFloor = ServiceHelper.Create <IFloorService>().GetHomeFloor(id); if (homeFloor != null) { homeFloorDetail.Id = homeFloor.Id; homeFloorDetail.DefaultTabName = homeFloor.DefaultTabName; homeFloorDetail.TextLinks = from item in homeFloor.FloorTopicInfo where item.TopicType == Position.Top select new HomeFloorDetail.TextLink() { Id = item.Id, Name = item.TopicName, Url = item.Url }; homeFloorDetail.ProductLinks = from item in homeFloor.FloorTopicInfo where item.TopicType != Position.Top select new HomeFloorDetail.TextLink() { Id = (long)item.TopicType, Name = item.Url, Url = item.TopicImage } into i orderby i.Id select i; homeFloorDetail.Tabs = from item in homeFloor.Himall_FloorTabls where item.FloorId == homeFloor.Id select item into p orderby p.Id select p into item select new HomeFloorDetail.Tab() { Id = item.Id, Detail = from detail in item.Himall_FloorTablDetails where detail.TabId == item.Id select detail into p select new HomeFloorDetail.ProductDetail() { Id = p.Id, ProductId = p.ProductId }, Name = item.Name, Count = ( from detail in item.Himall_FloorTablDetails where detail.TabId == item.Id select detail).Count(), Ids = ArrayToString(( from detail in item.Himall_FloorTablDetails where detail.TabId == item.Id select detail into p select p.ProductId).ToArray()) }; } else { homeFloor = new HomeFloorInfo(); List <HomeFloorDetail.TextLink> textLinks = new List <HomeFloorDetail.TextLink>(); for (int num = 0; num < 12; num++) { HomeFloorDetail.TextLink textLink = new HomeFloorDetail.TextLink() { Id = num, Name = "", Url = "" }; textLinks.Add(textLink); } homeFloorDetail.ProductLinks = textLinks; homeFloorDetail.StyleLevel = 1; } if (homeFloorDetail.Tabs == null) { homeFloorDetail.Tabs = new List <HomeFloorDetail.Tab>(); } dynamic viewBag = base.ViewBag; str = (homeFloor == null ? "" : homeFloor.FloorName); viewBag.FloorName = str; dynamic obj = base.ViewBag; str1 = (homeFloor == null ? "" : homeFloor.SubName); obj.SubName = str1; return(View(homeFloorDetail)); }