Example #1
0
        public async Task <ActionResult> GetArtist([FromBody] PageLimitViewModel model)
        {
            var artist = await _tagService.FindByIdAsync(model.Id);

            var artist1 = new
            {
                Id         = artist.Id,
                Title      = artist.Title,
                Pic        = string.IsNullOrEmpty(artist.Pic) ? "" : "http://mousigha.com/content/files/tag/" + artist.Pic,
                Thumbnail  = string.IsNullOrEmpty(artist.Thumbnail) ? "" : "http://mousigha.com/content/files/tag/" + artist.Thumbnail,
                Content    = string.IsNullOrEmpty(artist.Content) ? "" : artist.Content,
                LikeCount  = artist.LikeCount,
                VisitCount = artist.VisitCount,
                ShareLink  = "http://mousigha.com/artist/detail/" + artist.Id,

                albums = artist.CategoryTags.ToList().Select(p => p.Category).ToList().Where(p => p.IsPublish).Select(p => new
                {
                    Id        = p.Id,
                    Title     = p.Title,
                    Thumbnail = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                    Pic       = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/album/" + p.Pic,
                    LikeCount = p.LikeCount,
                    p.VisitCount,
                    ShareLink = "http://mousigha.com/album/detail/" + p.Id
                })
            };

            return(Ok(artist1));
        }
Example #2
0
        public ActionResult GetAllArtist([FromBody] PageLimitViewModel model)
        {
            var tag = _tagService.GetPagedTagsAsync(
                model.PageNumber,
                model.PageSize,
                SortOrder.Ascending,
                "artist", null, "alphabet",
                true, null).Result.Tags.ToList();



            var a = new
            {
                artists = tag.Select(p => new
                {
                    Id        = p.Id,
                    Title     = p.Title,
                    Pic       = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/tag/" + p.Pic,
                    Thumbnail = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/tag/" + p.Thumbnail,
                    LikeCount = p.LikeCount,
                    ShareLink = "http://mousigha.com/artist/detail/" + p.Id,

                    SubTitle = string.IsNullOrEmpty(p.Content) ? "" :

                               Regex.Replace(p.Content, "<.*?>", string.Empty).Length > 200 ?
                               Regex.Replace(p.Content, "<.*?>", string.Empty).Substring(0, 200).Replace("&nbsp;", " ") :
                               Regex.Replace(p.Content, "<.*?>", string.Empty)
                }),
                selected = model.PageNumber == 1
          ? _tagService.GetAllBySelected("artist").Select(p => new
                {
                    Id        = p.Id,
                    Title     = p.Title,
                    Pic       = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/tag/" + p.Pic,
                    Thumbnail = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/tag/" + p.Thumbnail,
                    ShareLink = "http://mousigha.com/artist/detail/" + p.Id,

                    LikeCount = p.LikeCount
                })
          : null,

                popular = model.PageNumber == 1
          ? _tagService.GetPagedTagsAsync(1, 10, SortOrder.Descending,
                                          "artist", null, "popular", true, null).Result.Tags.ToList().Select(p => new
                {
                    Id        = p.Id,
                    Title     = p.Title,
                    Pic       = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/tag/" + p.Pic,
                    Thumbnail = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/tag/" + p.Thumbnail,
                    LikeCount = p.LikeCount,
                    ShareLink = "http://mousigha.com/artist/detail/" + p.Id
                })
          : null
            };

            return(Ok(a));
        }
Example #3
0
        public async Task <ActionResult> GetStyleAndMusic([FromBody] PageLimitViewModel model)
        {
            var aa = (await _categoryService.GetPagedCategoryAsync(model.PageNumber, model.PageSize, SortOrder.Descending,
                                                                   "1", true, null, model.Id)).CategoryItem.ToList();

            var album = aa.Select(p => new AppHomeViewModel
            {
                Id         = p.Id,
                Title      = p.Title,
                Thumbnail  = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                Pic        = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/album/" + p.Pic,
                LikeCount  = p.LikeCount,
                VisitCount = p.VisitCount,
                ShareLink  = "http://mousigha.com/album/detail/" + p.Id,
                Artist     = p.CategoryTags?
                             .Where(t => t.Type == "artist").Select(art => new ArtistViewModel
                {
                    ArtistId   = art.Tag.Id,
                    ArtistName = art.Tag.Title
                }).ToList(),
            }).ToList();

            if (model.PageNumber == 1)
            {
                var artist = await _tagService.FindByIdAsync(model.Id);

                var artist1 = new
                {
                    Id         = artist.Id,
                    Title      = artist.Title,
                    Pic        = string.IsNullOrEmpty(artist.Pic) ? "" : "http://mousigha.com/content/files/tag/" + artist.Pic,
                    Thumbnail  = string.IsNullOrEmpty(artist.Thumbnail) ? "" : "http://mousigha.com/content/files/tag/" + artist.Thumbnail,
                    Content    = string.IsNullOrEmpty(artist.Content) ? "" : artist.Content,
                    LikeCount  = artist.LikeCount,
                    VisitCount = artist.VisitCount,
                    ShareLink  = "http://mousigha.com/style/detail/" + artist.Id,

                    albums = album
                };
                return(Ok(artist1));
            }
            else
            {
                var artist1 = new
                {
                    albums = album
                };
                return(Ok(artist1));
            }
        }
Example #4
0
        public async Task <ActionResult> GetVideoByArtist([FromBody] PageLimitViewModel model)
        {
            var artist = await _tagService.FindByIdAsync(model.Id);

            var videos = (await _contentFileService.GetByTagIdAsync(model.Id)).Select(p => new AppHomeViewModel
            {
                Id          = p.Id,
                Title       = p.Title,
                VideoArtist = artist.Title,
                Thumbnail   = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                Pic         = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                Video       = "http://mousigha.com/content/files/album/" + p.FileName,
                LikeCount   = p.LikeCount,
                VisitCount  = p.VisitCount,
                ShareLink   = "http://mousigha.com/video/detail/" + p.Id
            });

            return(Ok(videos));
        }
Example #5
0
        public ActionResult LikeItem([FromBody] PageLimitViewModel model)
        {
            if (model.Kind == "album")
            {
                var p = _categoryService.FindByIdAsync(model.Id, false).Result;

                if (model.Action == "like")
                {
                    p.LikeCount = p.LikeCount + 1;
                }
                else if (model.Action == "dislike")
                {
                    p.LikeCount = p.LikeCount - 1;
                }

                _categoryService.UpdateCategory(p, null, null, null, null);

                return(Ok(p.LikeCount));
            }

            if (model.Kind == "music")
            {
                var p = _contentService.FindByIdAsync(model.Id).Result;

                if (model.Action == "like")
                {
                    p.LikeCount = p.LikeCount + 1;
                }
                else if (model.Action == "dislike")
                {
                    p.LikeCount = p.LikeCount - 1;
                }

                _contentService.UpdateContent(p, null, null, null, null, null, null, null, null, null);

                return(Ok(p.LikeCount));
            }


            if (model.Kind == "artist")
            {
                var p = _tagService.FindByIdAsync(model.Id).Result;

                if (model.Action == "like")
                {
                    p.LikeCount = p.LikeCount + 1;
                }
                else if (model.Action == "dislike")
                {
                    p.LikeCount = p.LikeCount - 1;
                }

                _tagService.UpdateTag(p, null);

                return(Ok(p.LikeCount));
            }

            if (model.Kind == "video")
            {
                var p = _contentFileService.FindByIdAsync(model.Id).Result;

                if (model.Action == "like")
                {
                    p.LikeCount = p.LikeCount + 1;
                }
                else if (model.Action == "dislike")
                {
                    p.LikeCount = p.LikeCount - 1;
                }
                _contentFileService.UpdateContentFile(p, null, null, null, null);

                return(Ok(p.LikeCount));
            }


            return(Ok());
        }
Example #6
0
        public ActionResult GetAll([FromBody] PageLimitViewModel model)
        {
            if (model.Kind == "album")
            {
                if (model.OrderBy == "last")
                {
                    var morLiked = _categoryService.GetTopByType("1", model.PageNumber, model.PageSize, "", true).Select(
                        p => new AppHomeViewModel
                    {
                        Id    = p.Id,
                        Title = p.Title,
                        //   Artist = p.CategoryTags != null ? (string.Join(",", p.CategoryTags.Where(t => t.Type == "artist").Select(x => x.Tag).Select(a => a.Title))) : null,
                        Artist = p.CategoryTags?
                                 .Where(t => t.Type == "artist").Select(art => new ArtistViewModel
                        {
                            ArtistId   = art.Tag.Id,
                            ArtistName = art.Tag.Title
                        }).ToList(),

                        Thumbnail  = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                        Pic        = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/album/" + p.Pic,
                        Type       = "last",
                        Kind       = "album",
                        TypeName   = "آخرین ها",
                        LikeCount  = p.LikeCount,
                        VisitCount = p.VisitCount,

                        Rate      = 5,
                        ShareLink = "http://mousigha.com/album/detail/" + p.Id
                    });
                    return(Ok(morLiked));
                }
                if (model.OrderBy == "like")
                {
                    var lk = _categoryService.GetTopByLike("1", model.PageNumber, model.PageSize, true).Select(
                        p => new AppHomeViewModel
                    {
                        Id    = p.Id,
                        Title = p.Title,
                        //Artist = (string.Join(",", p.CategoryTags.Where(t => t.Type == "artist").Select(x => x.Tag).Select(a => a.Title))),
                        // Artist = p.CategoryTags != null ? (string.Join(",", p.CategoryTags.Where(t => t.Type == "artist").Select(x => x.Tag).Select(a => a.Title))) : null,
                        Artist = p.CategoryTags?
                                 .Where(t => t.Type == "artist").Select(art => new ArtistViewModel
                        {
                            ArtistId   = art.Tag.Id,
                            ArtistName = art.Tag.Title
                        }).ToList(),
                        Thumbnail  = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                        Pic        = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/album/" + p.Pic,
                        Type       = "like",
                        Kind       = "album",
                        TypeName   = "محبوب ترین ها",
                        LikeCount  = p.LikeCount,
                        VisitCount = p.VisitCount,
                        Rate       = 5,
                        ShareLink  = "http://mousigha.com/album/detail/" + p.Id
                    });
                    return(Ok(lk));
                }
            }

            if (model.Kind == "video")
            {
                var moreLike = new List <AppHomeViewModel>();
                if (model.PageNumber == 1)
                {
                    moreLike = (_contentFileService.GetTopByTypeAsync("video", 1, 6, "", "like").Result).ToList()
                               .Select(p => new AppHomeViewModel
                    {
                        Id          = p.Id,
                        Title       = p.Title,
                        VideoArtist = p.Content.Category.CategoryTags != null
                  ? (string.Join(",",
                                 p.Content.Category.CategoryTags.Where(t => t.Type == "artist").Select(x => x.Tag)
                                 .Select(a => a.Title)))
                  : "",
                        Thumbnail = string.IsNullOrEmpty(p.Thumbnail)
                  ? ""
                  : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                        Pic        = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                        Video      = "http://mousigha.com/content/files/album/" + p.FileName,
                        Type       = "last",
                        Kind       = "video",
                        TypeName   = "آخرین ویدئوها",
                        LikeCount  = p.LikeCount,
                        VisitCount = p.VisitCount,
                        ShareLink  = "http://mousigha.com/video/detail/" + p.Id
                    }).ToList();
                }
                var videos = (_contentFileService.GetTopByTypeAsync("video", model.PageNumber, model.PageSize, "", "").Result).ToList()
                             .Select(p => new AppHomeViewModel
                {
                    Id          = p.Id,
                    Title       = p.Title,
                    VideoArtist = p.Content.Category.CategoryTags != null ? (string.Join(",", p.Content.Category.CategoryTags.Where(t => t.Type == "artist").Select(x => x.Tag).Select(a => a.Title))) : "",
                    Thumbnail   = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                    Pic         = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                    Video       = "http://mousigha.com/content/files/album/" + p.FileName,
                    Type        = "last",
                    Kind        = "video",
                    TypeName    = "آخرین ویدئوها",
                    LikeCount   = p.LikeCount,
                    VisitCount  = p.VisitCount,
                    ShareLink   = "http://mousigha.com/video/detail/" + p.Id
                });
                return(Ok(new
                {
                    videos,
                    moreLike
                }));
            }

            if (model.Kind == "tag")
            {
                // if (model.OrderBy == "last")
                {
                    var tag = _tagService.GetPagedTagsAsync(1, 10, SortOrder.Descending, "tag", null, "last", true, null).Result.Tags.ToList();

                    var tags = tag.Select(p => new AppHomeViewModel
                    {
                        Id        = p.Id,
                        Title     = "#" + p.Title.Replace(" ", "_"),
                        Pic       = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/tag/" + p.Pic,
                        Thumbnail = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/tag/" + p.Thumbnail,
                        Type      = "last",
                        Kind      = "tag",
                        TypeName  = "تگ ها",
                        LikeCount = p.LikeCount,
                        ShareLink = "http://mousigha.com/tag/detail/" + p.Id
                    });

                    return(Ok(tags));
                }
            }


            if (model.Kind == "style")
            {
                //   if (model.OrderBy == "last")
                {
                    var tag = _tagService.GetPagedTagsAsync(model.PageNumber, model.PageSize, SortOrder.Descending, model.Kind, null, "", true, null).Result.Tags.ToList();

                    var tags = tag.Select(p => new AppHomeViewModel
                    {
                        Id         = p.Id,
                        Title      = p.Title,
                        Pic        = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/tag/" + p.Pic,
                        Thumbnail  = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/tag/" + p.Thumbnail,
                        Type       = "last",
                        Kind       = "style",
                        TypeName   = "سبک ها",
                        LikeCount  = p.LikeCount,
                        VisitCount = p.VisitCount,
                        ShareLink  = "http://mousigha.com/style/detail/" + p.Id
                    });

                    return(Ok(tags));
                }
            }

            if (model.Kind == "music")
            {
                // if (model.OrderBy == "last")
                {
                    var tag = _tagService.GetPagedTagsAsync(model.PageNumber, model.PageSize, SortOrder.Descending, "music", null, "last", true, null).Result.Tags.ToList();

                    var tags = tag.Select(p => new AppHomeViewModel
                    {
                        Id         = p.Id,
                        Title      = p.Title,
                        Pic        = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/tag/" + p.Pic,
                        Thumbnail  = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/tag/" + p.Thumbnail,
                        Type       = "last",
                        Kind       = "music",
                        TypeName   = "ساز ها",
                        LikeCount  = p.LikeCount,
                        VisitCount = p.VisitCount,
                        ShareLink  = "http://mousigha.com/music/detail/" + p.Id
                    });
                    return(Ok(tags));
                }
            }



            if (model.Kind == "artist")
            {
                if (model.OrderBy == "last")
                {
                    var tag = _tagService.GetPagedTagsAsync(model.PageNumber, model.PageSize, SortOrder.Descending, model.Kind, null, "last", true, null).Result.Tags.ToList();

                    var tags = tag.Select(p => new AppHomeViewModel
                    {
                        Id         = p.Id,
                        Title      = p.Title,
                        Pic        = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/tag/" + p.Pic,
                        Thumbnail  = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/tag/" + p.Thumbnail,
                        Type       = "last",
                        Kind       = "artist",
                        TypeName   = "هنرمندان",
                        LikeCount  = p.LikeCount,
                        VisitCount = p.VisitCount,

                        Rate      = 0,
                        ShareLink = "http://mousigha.com/artist/detail/" + p.Id
                    });

                    return(Ok(tags));
                }
            }


            if (model.Kind == "all")
            {
                var latest = _categoryService.GetTopByType("1", model.PageNumber, model.PageSize, "", true).Select(
                    p => new AppHomeViewModel
                {
                    Id    = p.Id,
                    Title = p.Title,
                    //  Artist = p.CategoryTags != null ? (string.Join(",", p.CategoryTags.Where(t => t.Type == "artist").Select(x => x.Tag).Select(a => a.Title))) : null,
                    Artist = p.CategoryTags?
                             .Where(t => t.Type == "artist").Select(art => new ArtistViewModel
                    {
                        ArtistId   = art.Tag.Id,
                        ArtistName = art.Tag.Title
                    }).ToList(),
                    Thumbnail  = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                    Pic        = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/album/" + p.Pic,
                    Type       = "album-last",
                    Kind       = "album",
                    OrderBy    = "last",
                    TypeName   = "آخرین ها",
                    LikeCount  = p.LikeCount,
                    VisitCount = p.VisitCount,
                    Rate       = 5,
                    ShareLink  = "http://mousigha.com/album/detail/" + p.Id
                });

                var morLiked = _categoryService.GetTopByLike("1", model.PageNumber, model.PageSize, true).Select(
                    p => new AppHomeViewModel
                {
                    Id    = p.Id,
                    Title = p.Title,
                    //  Artist = p.CategoryTags != null ? (string.Join(",", p.CategoryTags.Where(t => t.Type == "artist").Select(x => x.Tag).Select(a => a.Title))) : null,
                    Artist = p.CategoryTags?
                             .Where(t => t.Type == "artist").Select(art => new ArtistViewModel
                    {
                        ArtistId   = art.Tag.Id,
                        ArtistName = art.Tag.Title
                    }).ToList(),
                    Thumbnail = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                    Pic       = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/album/" + p.Pic,

                    Type       = "album-like",
                    Kind       = "album",
                    OrderBy    = "like",
                    TypeName   = "محبوب ترین ها",
                    LikeCount  = p.LikeCount,
                    VisitCount = p.VisitCount,

                    Rate      = 5,
                    ShareLink = "http://mousigha.com/album/detail/" + p.Id
                });


                var style = _tagService.GetPagedTagsAsync(1, 10, SortOrder.Descending, "style", null, "", true, null).Result.Tags.ToList();

                var styles = style.Select(p => new AppHomeViewModel
                {
                    Id    = p.Id,
                    Title = p.Title,
                    //   Artist = (string.Join(",", p.CategoryTags.Where(t => t.Type == "artist").Select(x => x.Tag).Select(a => a.Title))),
                    Pic        = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/tag/" + p.Pic,
                    Thumbnail  = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/tag/" + p.Thumbnail,
                    Video      = null,
                    Type       = "style-last",
                    Kind       = "style",
                    OrderBy    = "last",
                    TypeName   = "سبک ها",
                    LikeCount  = p.LikeCount,
                    VisitCount = p.VisitCount,

                    Rate      = 0,
                    ShareLink = "http://mousigha.com/style/detail/" + p.Id
                });

                var tag = _tagService.GetPagedTagsAsync(1, 10, SortOrder.Descending, "tag", null, "", true, null).Result.Tags.ToList();

                var tags = tag.Select(p => new AppHomeViewModel
                {
                    Id         = p.Id,
                    Title      = "#" + p.Title.Replace(" ", "_"),
                    Pic        = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/tag/" + p.Pic,
                    Thumbnail  = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/tag/" + p.Thumbnail,
                    Type       = "tag-last",
                    Kind       = "tag",
                    OrderBy    = "last",
                    TypeName   = "تگ ها",
                    LikeCount  = p.LikeCount,
                    VisitCount = p.VisitCount,
                    Rate       = 0,
                    ShareLink  = "http://mousigha.com/tag/detail/" + p.Id
                });

                var videos = (_contentFileService.GetTopByTypeAsync("video", model.PageNumber, model.PageSize, "", "").Result).ToList()
                             .Select(p => new AppHomeViewModel
                {
                    Id          = p.Id,
                    Title       = p.Title,
                    VideoArtist = p.Content.Category.CategoryTags != null ? (string.Join(",", p.Content.Category.CategoryTags.Where(t => t.Type == "artist").Select(x => x.Tag).Select(a => a.Title))) : null,
                    //VideoArtist = p.CategoryTags?
                    //          .Where(t => t.Type == "artist").Select(art => new ArtistViewModel
                    //          {
                    //              ArtistId = art.Tag.Id,
                    //              ArtistName = art.Tag.Title
                    //          }).ToList(),
                    Thumbnail  = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                    Pic        = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                    Video      = string.IsNullOrEmpty(p.FileName) ? "" : "http://mousigha.com/content/files/album/" + p.FileName,
                    Type       = "video-last",
                    Kind       = "video",
                    OrderBy    = "last",
                    TypeName   = "آخرین ویدئوها",
                    LikeCount  = p.LikeCount,
                    VisitCount = p.VisitCount,
                    Rate       = 0,
                    ShareLink  = "https://www.mousigha.com/album/detail/" + p.Id
                });


                var sliders = (_sliderService.GetAll(1, "enable", model.PageNumber, model.PageSize)).ToList()
                              .Select(p => new AppHomeViewModel
                {
                    Title = p.Title,
                    Pic   = string.IsNullOrEmpty(p.Pic) ? "" : "https://www.mousigha.com/content/files/slider/" + p.Pic,
                    Video = "",
                    //Type = p.Link.StartsWith("https://www.mousigha.com/album")==true?"album":"100",
                    Kind     = "slider",
                    OrderBy  = "last",
                    TypeName = "اسلایدر",
                    Type     = SetType(p.Link),
                    Link     = p.Link,
                    Rate     = 0,
                    SubTitle = p.SubTitle,

                    Id = SetType(p.Link) == "album" ? Convert.ToInt32(Regex.Match(p.Link, @"\d+$").Value) : p.Id
                });


                var merged = sliders.Union(styles).ToList();
                merged = merged.Union(latest.ToList()).ToList();
                merged = merged.Union(tags.ToList()).ToList();
                merged = merged.Union(morLiked.ToList()).ToList();
                merged = merged.Union(videos.ToList()).ToList();

                //merged = merged.Union(sliders.ToList()).ToList();
                //var merged = morLiked.Union(latest).ToList();
                //merged = merged.Union(styles.ToList()).ToList();
                //merged = merged.Union(videos.ToList()).ToList();
                //merged = merged.Union(tags.ToList()).ToList();
                //merged = merged.Union(sliders.ToList()).ToList();

                return(Ok(merged));
            }


            return(Ok());
        }
Example #7
0
        public ActionResult GetItemList([FromBody] PageLimitViewModel model)
        {
            if (model.Kind == "album")
            {
                var p = _categoryService.FindByIdAsync(model.Id, model.FirstVisit).Result;

                var album = new
                {
                    p.Id,
                    p.Title,

                    Artist = p.CategoryTags != null ? (string.Join(",", p.CategoryTags.Where(t => t.Type == "artist").Select(x => x.Tag).Select(a => a.Title))) : null,
                    p.ContentText,
                    p.Description,
                    p.VisitCount,
                    Thumbnail = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                    Pic       = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/album/" + p.Pic,
                    p.LikeCount,

                    ShareLink = "http://mousigha.com/album/detail/" + p.Id,


                    Musics = p.Contents.Select(a => new
                    {
                        a.Id,
                        Mp3128 = string.IsNullOrEmpty(a.Mp3128) ? "" : "http://mousigha.com/content/files/album/" + a.Mp3128,
                        Mp364  = string.IsNullOrEmpty(a.Mp364) ? "" : "http://mousigha.com/content/files/album/" + a.Mp364,
                        Mp3320 = string.IsNullOrEmpty(a.Mp3320) ? "" : "http://mousigha.com/content/files/album/" + a.Mp3320,

                        a.ContentText,
                        Title = Regex.Replace(a.Title, @"^[\d-]*\s*", "", RegexOptions.Multiline),

                        Thumbnail = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                        ShareLink = "http://mousigha.com/content/files/album/" + a.Mp364,

                        //   a.Thumbnail,
                        a.VisitCount,
                        a.LikeCount
                    })
                };
                return(Ok(album));
            }

            if (model.Kind == "video")
            {
                var p = _contentFileService.FindByIdAsync(model.Id, model.FirstVisit).Result;

                var video = new
                {
                    p.Id,
                    p.Title,
                    ArtistId = p.Content?.Category?.CategoryTags?.FirstOrDefault(t => t.Type == "artist")?.TagId,
                    Artist   = p.Content.Category.CategoryTags != null ? (string.Join(",", p.Content.Category.CategoryTags.Where(t => t.Type == "artist").Select(x => x.Tag).Select(a => a.Title))) : null,
                    p.ContentText,
                    Description = p.ContentText,
                    Thumbnail   = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                    Pic         = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/album/" + p.Pic,
                    p.LikeCount,
                    Video = string.IsNullOrEmpty(p.FileName) ? "" : "http://mousigha.com/content/files/album/" + p.FileName,
                    p.VisitCount,
                    ShareLink = "http://mousigha.com/video/detail/" + p.Id
                };

                return(Ok(video));
            }

            if (model.Kind == "tag" || model.Kind == "style" || model.Kind == "music")
            {
                var tags = _categoryService.GetTopByTypeAsync("1", model.PageNumber, model.PageSize, model.Id, true).Result.Select(
                    p => new AppHomeViewModel
                {
                    Id    = p.Id,
                    Title = p.Title,
                    //  Artist = p.CategoryTags != null ? (string.Join(",", p.CategoryTags.Where(t => t.Type == "artist").Select(x => x.Tag).Select(a => a.Title))) : null,
                    Artist = p.CategoryTags?
                             .Where(t => t.Type == "artist").Select(art => new ArtistViewModel
                    {
                        ArtistId   = art.Tag.Id,
                        ArtistName = art.Tag.Title
                    }).ToList(),

                    Thumbnail = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                    Pic       = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/album/" + p.Pic,
                    //Type = "last",
                    //Kind = "album",
                    //TypeName = "آخرین ها",
                    LikeCount  = p.LikeCount,
                    VisitCount = p.VisitCount,
                    ShareLink  = "http://mousigha.com/style/detail/" + p.Id
                });
                return(Ok(tags));
            }
            return(Ok());
        }
Example #8
0
        public async Task <ActionResult> GetAlbumById([FromBody]  PageLimitViewModel model)
        {
            var p = await _categoryService.FindByIdAsync(model.Id, model.FirstVisit);

            var videos = await _contentFileService.GetByCatIdAsync(model.Id);

            string artist = p.CategoryTags != null
        ? (string.Join(",", p.CategoryTags.Where(t => t.Type == "artist").Select(x => x.Tag).Select(a => a.Title)))
        : null;
            var album = new
            {
                p.Id,
                p.Title,
                Artist = artist,
                p.ContentText,
                p.Description,
                p.VisitCount,
                Thumbnail = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                Pic       = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/album/" + p.Pic,
                ArtistId  = p.CategoryTags?.FirstOrDefault(t => t.Type == "artist")?.TagId,

                ShareLink = "http://mousigha.com/album/detail/" + p.Id,

                Zip128 = p.ZipMp3128 == null ? (p.Contents.Any(s => s.Mp3128 != null) ? "https://www.mousigha.com/album/download?type=128&id=" + p.Id : "") : "https://www.mousigha.com/content/files/album/" + p.ZipMp3128,
                Zip64  = p.ZipMp364 == null ? (p.Contents.Any(s => s.Mp364 != null) ? "https://www.mousigha.com/album/download?type=64&id=" + p.Id : "") : "https://www.mousigha.com/content/files/album/" + p.ZipMp364,
                Zip320 = p.ZipMp3320 == null ? (p.Contents.Any(s => s.Mp3320 != null) ? "https://www.mousigha.com/album/download?type=320&id=" + p.Id : "") : "https://www.mousigha.com/content/files/album/" + p.ZipMp3320,

                p.LikeCount,
                Musics = p.Contents.Select(a => new
                {
                    a.Id,
                    Mp3128 = string.IsNullOrEmpty(a.Mp3128) ? "" : "http://mousigha.com/content/files/album/" + a.Mp3128,
                    Mp364  = string.IsNullOrEmpty(a.Mp364) ? "" : "http://mousigha.com/content/files/album/" + a.Mp364,
                    Mp3320 = string.IsNullOrEmpty(a.Mp3320) ? "" : "http://mousigha.com/content/files/album/" + a.Mp3320,


                    a.ContentText,
                    Title     = Regex.Replace(a.Title, @"^[\d-]*\s*", "", RegexOptions.Multiline),
                    Artist    = artist,
                    Thumbnail = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                    Pic       = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/album/" + p.Pic,
                    a.VisitCount,
                    ShareLink = "http://mousigha.com/content/files/album/" + a.Mp364,
                    AlbumName = p.Title,
                    a.LikeCount
                }),

                Tags = p.CategoryTags?.Where(ct => ct.Type == "tag").Select(t => new
                {
                    t.Tag.Id,
                    ShareLink = "http://mousigha.com/share",

                    Title = "#" + t.Tag.Title.Replace(" ", "_")
                }),

                Videos = videos.Select(v => new
                {
                    v.Id,
                    v.Title,
                    FileName  = string.IsNullOrEmpty(v.FileName) ? "" : "http://mousigha.com/content/files/album/" + v.FileName,
                    Pic       = string.IsNullOrEmpty(v.Pic) ? "" : "http://mousigha.com/content/files/album/" + v.Pic,
                    Thumbnail = string.IsNullOrEmpty(v.Thumbnail) ? "" : "http://mousigha.com/content/files/album/" + v.Thumbnail,
                    v.Ext,
                    v.VisitCount,
                    v.ContentText,
                    ShareLink = "http://mousigha.com/video/detail/" + v.Id,
                    v.LikeCount
                })
            };

            return(Ok(album));
        }
Example #9
0
        public ActionResult GetById([FromBody] PageLimitViewModel model)
        {
            var video    = _contentFileService.FindByIdAsync(model.Id, model.FirstVisit).Result;
            var artistId = video.Content?.Category?.CategoryTags?.FirstOrDefault(t => t.Type == "artist")?.TagId;

            var rel = _contentFileService.GetByTagIdAsync((int)artistId).Result.Where(p => p.Id != model.Id);

            var result = new
            {
                video = new
                {
                    video.Id,
                    Video     = "http://mousigha.com/content/files/album/" + video.FileName,
                    Pic       = "http://mousigha.com/content/files/album/" + video.Thumbnail,
                    Thumbnail = "http://mousigha.com/content/files/album/" + video.Thumbnail,
                    ArtistId  = video.Content?.Category?.CategoryTags?.FirstOrDefault(t => t.Type == "artist")?.TagId,

                    video.Title,
                    video.VisitCount,
                    video.LikeCount,
                    Description = video.ContentText,


                    Artist = video.Content.Category.CategoryTags != null ?
                             (string.Join(",", video.Content.Category.CategoryTags.Where(t => t.Type == "artist")
                                          .Select(x => x.Tag).Select(a => a.Title))) : null,
                    ShareLink = "http://mousigha.com/video/detail/" + video.Id,

                    Related = rel.Select(
                        p => new
                    {
                        p.Id,
                        Video     = "http://mousigha.com/content/files/album/" + p.FileName,
                        Pic       = "http://mousigha.com/content/files/album/" + p.Thumbnail,
                        Thumbnail = "http://mousigha.com/content/files/album/" + p.Thumbnail,
                        p.Title,
                        p.VisitCount,
                        p.LikeCount,
                        p.Description,
                        //
                    })
                },
                ArtistVideo = rel.Select(
                    p => new
                {
                    p.Id,
                    Video     = "http://mousigha.com/content/files/album/" + p.FileName,
                    Pic       = "http://mousigha.com/content/files/album/" + p.Thumbnail,
                    Thumbnail = "http://mousigha.com/content/files/album/" + p.Thumbnail,

                    p.Title,
                    p.VisitCount,
                    p.LikeCount,
                    p.Description,
                    //  ShareLink = "http://mousigha.com/share"
                }
                    )
            };

            return(Ok(result));
        }
Example #10
0
        public ActionResult GetAll([FromBody] PageLimitViewModel model)
        {
            if (string.IsNullOrEmpty(model.Term))
            {
                return(Ok());
            }
            if (model.Kind == "album")
            {
                var albums = _categoryService.GetForSearch("1", model.PageNumber, model.PageSize, model.Term, true).Select(
                    p => new AppHomeViewModel
                {
                    Id    = p.Id,
                    Title = p.Title,
                    // Artist = p.CategoryTags != null ? (string.Join(",", p.CategoryTags.Where(t => t.Type == "artist").Select(x => x.Tag).Select(a => a.Title))) : null,
                    Artist = p.CategoryTags?
                             .Where(t => t.Type == "artist").Select(art => new ArtistViewModel
                    {
                        ArtistId   = art.Tag.Id,
                        ArtistName = art.Tag.Title
                    }).ToList(),
                    Thumbnail = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                    Kind      = "album",
                    ShareLink = "http://mousigha.com/album/detail/" + p.Id,

                    VisitCount = p.VisitCount,
                    LikeCount  = p.LikeCount,
                    TypeName   = "آلبوم ها",
                });
                return(Ok(albums));
            }

            if (model.Kind == "artist")
            {
                var artist = _tagService.GetPagedTags(model.PageNumber, model.PageSize, "artist", model.Term).Select(
                    p => new AppHomeViewModel
                {
                    Id        = p.Id,
                    Title     = p.Title,
                    Pic       = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/tag/" + p.Pic,
                    Thumbnail = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/tag/" + p.Thumbnail,

                    VisitCount = p.VisitCount,
                    LikeCount  = p.LikeCount,
                    Kind       = "artist",
                    TypeName   = "هنرمندان",
                    ShareLink  = "http://mousigha.com/artist/detail/" + p.Id,


                    SubTitle = p.Content != null ? Regex.Replace(p.Content, "<.*?>", string.Empty).Length > 200 ?
                               Regex.Replace(p.Content, "<.*?>", string.Empty).Substring(0, 200).Replace("&nbsp;", " ").Replace("&zwnj", " ").Replace("&zwj", " ") :
                               Regex.Replace(p.Content, "<.*?>", string.Empty) : ""
                });
                return(Ok(artist));
            }


            if (model.Kind == "style")
            {
                var style =
                    _tagService.GetPagedTags(model.PageNumber, model.PageSize, "style", model.Term).Select(
                        p => new AppHomeViewModel
                {
                    Id         = p.Id,
                    Title      = p.Title,
                    Pic        = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/tag/" + p.Pic,
                    Thumbnail  = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/tag/" + p.Thumbnail,
                    VisitCount = p.VisitCount,
                    LikeCount  = p.LikeCount,
                    Kind       = "style",
                    ShareLink  = "http://mousigha.com/style/detail/" + p.Id,


                    TypeName = "سبک ها",
                    SubTitle = Regex.Replace(p.Content, "<.*?>", string.Empty).Length > 200 ?
                               Regex.Replace(p.Content, "<.*?>", string.Empty).Substring(0, 200).Replace("&nbsp;", " ").Replace("&zwnj", " ").Replace("&zwj", " ") :
                               Regex.Replace(p.Content, "<.*?>", string.Empty)
                });

                return(Ok(style.ToList()));
            }


            if (model.Kind == "music")
            {
                var music =
                    _tagService.GetPagedTags(model.PageNumber, model.PageSize, "music", model.Term).Select(
                        p => new AppHomeViewModel
                {
                    Id         = p.Id,
                    Title      = p.Title,
                    Pic        = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/tag/" + p.Pic,
                    Thumbnail  = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/tag/" + p.Thumbnail,
                    VisitCount = p.VisitCount,
                    LikeCount  = p.LikeCount,
                    Kind       = "music",
                    ShareLink  = "http://mousigha.com/music/detail/" + p.Id,

                    TypeName = "سازها",
                    SubTitle = Regex.Replace(p.Content, "<.*?>", string.Empty).Length > 200 ?
                               Regex.Replace(p.Content, "<.*?>", string.Empty).Substring(0, 200).Replace("&nbsp;", " ").Replace("&zwnj", " ").Replace("&zwj", " ") :
                               Regex.Replace(p.Content, "<.*?>", string.Empty)
                });

                return(Ok(music.ToList()));
            }



            if (model.Kind == "video")
            {
                var artist = _contentFileService.GetTopByTypeAsync("video", model.PageNumber, model.PageSize, model.Term, "").Result.Select(
                    p => new AppHomeViewModel
                {
                    VisitCount = p.VisitCount,
                    LikeCount  = p.LikeCount,
                    Id         = p.Id,
                    Title      = p.Title,
                    Thumbnail  = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                    Video      = string.IsNullOrEmpty(p.FileName) ? "" : "http://mousigha.com/content/files/album/" + p.FileName,
                    Kind       = "video",
                    ShareLink  = "http://mousigha.com/video/detail/" + p.Id,
                    TypeName   = "موزیک ویدیو"
                });
                return(Ok(artist));
            }

            else
            {
                var albums = _categoryService.GetForSearch("1", model.PageNumber, model.PageSize, model.Term, true).Select(
                    p => new AppHomeViewModel
                {
                    VisitCount = p.VisitCount,
                    LikeCount  = p.LikeCount,
                    Id         = p.Id,
                    Title      = p.Title,
                    //  Artist = p.CategoryTags != null ? (string.Join(",", p.CategoryTags.Where(t => t.Type == "artist").Select(x => x.Tag).Select(a => a.Title))) : null,
                    Artist = p.CategoryTags?
                             .Where(t => t.Type == "artist").Select(art => new ArtistViewModel
                    {
                        ArtistId   = art.Tag.Id,
                        ArtistName = art.Tag.Title
                    }).ToList(),
                    ShareLink = "http://mousigha.com/album/detail/" + p.Id,

                    Thumbnail = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                    Type      = "last",
                    Kind      = "album",
                    TypeName  = "آلبوم ها",
                });

                var artist = _tagService.GetPagedTags(model.PageNumber, model.PageSize, "artist", model.Term).Select(
                    p => new AppHomeViewModel
                {
                    Id         = p.Id,
                    Title      = p.Title,
                    Pic        = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/tag/" + p.Pic,
                    Thumbnail  = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/tag/" + p.Thumbnail,
                    VisitCount = p.VisitCount,
                    LikeCount  = p.LikeCount,
                    Kind       = "artist",
                    ShareLink  = "http://mousigha.com/artist/detail/" + p.Id,
                    TypeName   = "هنرمندان",
                    SubTitle   = p.Content != null ? Regex.Replace(p.Content, "<.*?>", string.Empty).Length > 200 ?
                                 Regex.Replace(p.Content, "<.*?>", string.Empty).Substring(0, 200).Replace("&nbsp;", " ").Replace("&zwnj", " ").Replace("&zwj", " ") :
                                 Regex.Replace(p.Content, "<.*?>", string.Empty) : ""
                });

                var style = _tagService.GetPagedTags(model.PageNumber, model.PageSize, "style", model.Term).Select(
                    p => new AppHomeViewModel
                {
                    Id         = p.Id,
                    Title      = p.Title,
                    Pic        = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/tag/" + p.Pic,
                    Thumbnail  = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/tag/" + p.Thumbnail,
                    VisitCount = p.VisitCount,
                    LikeCount  = p.LikeCount,
                    Kind       = "style",
                    ShareLink  = "http://mousigha.com/style/detail/" + p.Id,
                    TypeName   = "سبک ها",
                });

                var music = _tagService.GetPagedTags(model.PageNumber, model.PageSize, "music", model.Term).Select(
                    p => new AppHomeViewModel
                {
                    Id         = p.Id,
                    Title      = p.Title,
                    Pic        = string.IsNullOrEmpty(p.Pic) ? "" : "http://mousigha.com/content/files/tag/" + p.Pic,
                    Thumbnail  = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/tag/" + p.Thumbnail,
                    VisitCount = p.VisitCount,
                    LikeCount  = p.LikeCount,
                    Kind       = "music",
                    ShareLink  = "http://mousigha.com/music/detail/" + p.Id,


                    TypeName = "ساز ها",
                });

                style = style.Union(music);

                var video = _contentFileService.GetTopByTypeAsync("video", model.PageNumber, model.PageSize, model.Term, "").Result.Select(
                    p => new AppHomeViewModel
                {
                    VisitCount = p.VisitCount,
                    LikeCount  = p.LikeCount,
                    Id         = p.Id,
                    Title      = p.Title,
                    Thumbnail  = string.IsNullOrEmpty(p.Thumbnail) ? "" : "http://mousigha.com/content/files/album/" + p.Thumbnail,
                    Video      = string.IsNullOrEmpty(p.FileName) ? "" : "http://mousigha.com/content/files/album/" + p.FileName,
                    Kind       = "video",
                    ShareLink  = "http://mousigha.com/video/detail/" + p.Id,
                    TypeName   = "موزیک ویدیو"
                });

                var merged = albums.Union(artist).ToList();
                merged = merged.Union(style.ToList()).ToList();
                merged = merged.Union(video.ToList()).ToList();
                return(Ok(merged));
            }
        }
Example #11
0
        public ActionResult Visit([FromBody] PageLimitViewModel model)
        {
            var result = _contentService.UpdateVisit(model.Id).VisitCount;

            return(Ok(result));
        }