Beispiel #1
0
 public async Task <ActionResult> Index(HomeContentModel model, int page = 1, int pageSize = 20)
 {
     using (ZavrsniEFentities db = new ZavrsniEFentities())
     {
         return(RedirectToAction("Search", new { keyword = model.keyword, page = page, pageSize = pageSize }));
     }
 }
Beispiel #2
0
        public ActionResult Index(int page = 1, int pageSize = 20)
        {
            HomeContentModel model = new HomeContentModel();

            using (ZavrsniEFentities db = new ZavrsniEFentities())
            {
                if (Request.IsAuthenticated)
                {
                    var currentUser = User.Identity.GetUserName();
                    var user        = db.User.FirstOrDefault(u => u.Username.Equals(currentUser));

                    var groupContents = (from g in db.Group
                                         join b in db.BelongsToGroup on g.IDgroup equals b.IDgroup
                                         join u in db.User on b.IDuser equals u.IDuser
                                         join c in db.Content on u.IDuser equals c.IDauthor
                                         where g.IDgroupOwner == user.IDuser &&
                                         g.IDgroup != 1 &&
                                         g.IDgroup == b.IDgroup &&
                                         c.IsCopied == false
                                         orderby c.TimeChanged descending
                                         select c).Include(c => c.User);
                    model.contents = new PagedList <Content>(groupContents, page, pageSize);
                }

                var allContents = (from c in db.Content
                                   orderby c.TimeChanged descending
                                   where c.IsCopied == false
                                   select c).Include(c => c.ContentType).Include(c => c.User);

                model.contentsGuest = new PagedList <Content>(allContents, page, pageSize);
                return(View(model));
            }
        }
Beispiel #3
0
        public override ActionResult Index(ContentModel model)
        {
            var homeContentModel = new HomeContentModel(model.Content);

            var pageModel = _homeBuilder.GetModel(model.Content);

            homeContentModel.PageModel = pageModel;

            return(CurrentTemplate(homeContentModel));
        }
Beispiel #4
0
        public async Task <IActionResult> GetArticle()
        {
            try
            {
                HomeContentModel content = await this.homeContent.GetArticle();

                return(this.Ok(new { content = content }));
            }
            catch (Exception e)
            {
                return(this.StatusCode(StatusCodes.Status400BadRequest, e.Message));
            }
        }