Esempio n. 1
0
        public ActionResult Index(string _searchKey, DateTime?_formDate, DateTime?_toDate, int?_pageIndex)
        {
            CommentView result;

            result = _services.GetAll(_searchKey, _formDate, _toDate, false, _pageIndex, 20);
            int totalPage = result?.Total ?? 0;

            ViewBag.TotalPage = totalPage;
            ViewBag.PageIndex = _pageIndex ?? 1;
            ViewBag.SearchKey = string.IsNullOrWhiteSpace(_searchKey) ? string.Empty : _searchKey;
            if (result != null && result.Comments.Count() > 0)
            {
                var model = result.Comments.Select(x => new modelComment
                {
                    commentBody     = x.commentBody,
                    commentEmail    = x.commentEmail,
                    commentFullName = x.commentFullName,
                    commentId       = x.commentId,
                    commentPhone    = x.commentPhone,
                    commentTime     = x.commentTime,
                    commentTitle    = x.commentTitle,
                    contentId       = x.contentId,
                    contentName     = _contentService.GetNameById(x.contentId),
                    isTrash         = x.isTrash
                });
                return(View(model));
            }
            else
            {
                var model = new List <modelComment>();
                return(View(model));
            }
        }
Esempio n. 2
0
        public ActionResult Index(string _searchKey, int?_parentId, DateTime?_fromDate, DateTime?_toDate, int?_pageIndex)
        {
            ContentView result;
            string      cookieLanguage = "1";

            if (Request.Cookies["cookieLanguage"] != null)
            {
                cookieLanguage = Request.Cookies["cookieLanguage"].Value.ToString();
            }
            int.TryParse(cookieLanguage, out int _languageId);
            result = _services.GetAll(_searchKey, _fromDate, _toDate, _parentId, "News", _languageId, false, _pageIndex, 20);
            int totalPage = result?.Total ?? 0;

            ViewBag.TotalPage = totalPage;
            ViewBag.PageIndex = _pageIndex ?? 1;
            ViewBag.SearchKey = string.IsNullOrWhiteSpace(_searchKey) ? string.Empty : _searchKey;
            ViewBag.FromDate  = _fromDate?.ToString("dd/MM/yyyy") ?? null;
            ViewBag.ToDate    = _toDate?.ToString("dd/MM/yyyy") ?? null;
            IEnumerable <DropdownModel> category = _services.Dropdownlist(0, null, "cnews", _languageId);

            ViewBag._parentId = category.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            if (result != null && result.Contents.Count() > 0)
            {
                IEnumerable <modelNews> model = result.Contents.Select(x => new modelNews
                {
                    Alias           = x.contentAlias,
                    BodyContent     = x.contentBody,
                    Id              = x.contentId,
                    Img             = x.contentThumbnail,
                    LanguageId      = x.languageId,
                    LanguageName    = _languageService.GetNameById(x.languageId),
                    MetaDescription = x.contentDescription,
                    MetaKeywords    = x.contentKeywords,
                    MetaTitle       = x.contentTitle,
                    Name            = x.contentName,
                    Note            = x.note,
                    ParentId        = x.parentId,
                    ParentName      = _services.GetNameById(x.parentId),
                    CreateTime      = x.updateTime.ToString("dd/MM/yyyy"),
                    Approval        = (x.approval ?? false),
                    IsHome          = (x.isHome ?? false)
                });
                return(View(model));
            }
            else
            {
                List <modelNews> model = new List <modelNews>();
                return(View(model));
            }
        }
Esempio n. 3
0
        public ActionResult Index(string _searchKey, int?_parentId, int?_pageIndex)
        {
            string cookieLanguage = "1";

            if (Request.Cookies["cookieLanguage"] != null)
            {
                cookieLanguage = Request.Cookies["cookieLanguage"].Value.ToString();
            }
            int.TryParse(cookieLanguage, out _languageId);
            ContentView result;

            result = _services.GetAll(_searchKey, null, null, _parentId, "Banner", _languageId, false, _pageIndex, 20);
            int totalPage = result?.Total ?? 0;

            ViewBag.TotalPage = totalPage;
            ViewBag.PageIndex = _pageIndex ?? 1;
            ViewBag.SearchKey = string.IsNullOrWhiteSpace(_searchKey) ? string.Empty : _searchKey;
            var category = _services.Dropdownlist(0, null, "cbanner", _languageId);

            ViewBag._parentId = category.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            if (result != null && result.Contents.Count() > 0)
            {
                var model = result.Contents.Select(x => new modelBanner
                {
                    Alias        = x.contentAlias,
                    BodyContent  = x.contentBody,
                    Id           = x.contentId,
                    Img          = x.contentThumbnail,
                    LanguageId   = x.languageId,
                    LanguageName = _languageService.GetNameById(x.languageId),
                    Name         = x.contentName,
                    ParentId     = x.parentId,
                    ParentName   = _services.GetNameById(x.parentId),
                    IsSort       = x.isSort,
                    IsTrash      = x.isTrash
                });
                return(View(model));
            }
            else
            {
                var model = new List <modelBanner>();
                return(View(model));
            }
        }