Esempio n. 1
0
        public async Task <ServiceResult <Models.Content.NewsContent> > GetBlockNews([FromUri] ViewModel.UserBlog.GetBlockNewsVM model)
        {
            try
            {
                IEnumerable <Models.Content.NewsContent> res = new List <Models.Content.NewsContent>();

                //Block Of Category News
                if (!string.IsNullOrWhiteSpace(model.BlockCode))
                {
                    res = await ContentRepository.GetBlockContent(await (ContentManagerRepository.GetBlockRssIds(model.CategoryId, model.BlockCode)), model.Count);
                }

                //Categories News
                if (string.IsNullOrWhiteSpace(model.BlockCode))
                {
                    res = await ContentRepository.GetBlockContent(await (ContentManagerRepository.GetCategoryRssIds(model.CategoryId)), model.Count);
                }

                return(new ServiceResult <Models.Content.NewsContent>
                {
                    Data = res,
                    ServiceResultStatus = (int)Rdio.Util.Common.ServiceResultStatus.OK,
                    ServiceResultMassage = Util.Common.ServiceResultMessage.OKMessage.ToString()
                });
            }
            catch (Exception ex)
            {
                return(new ServiceResult <Models.Content.NewsContent>
                {
                    Data = null,
                    ServiceResultStatus = (int)Rdio.Util.Common.ServiceResultStatus.Error,
                    ServiceResultMassage = ex.GetBaseException().Message
                });
            }
        }