コード例 #1
0
        public ActionResult Fake()
        {
            UsersRepository    a = new UsersRepository();
            CommentsRepository b = new CommentsRepository();
            TimeRepository     c = new TimeRepository();
            TasksRepository    d = new TasksRepository();

            b.Count();
            d.Count();
            c.Count();
            a.Count();

            return(View());
        }
コード例 #2
0
        public ActionResult Details(TaskDetailsVM model)
        {
            TasksRepository tasksRepository = new TasksRepository();

            model.Item = tasksRepository.GetById(model.Id);
            if (model == null)
            {
                return(RedirectToAction("Index", "Tasks"));
            }

            UsersRepository usersRepository = new UsersRepository();

            model.Users = usersRepository.GetAll();
            CommentsRepository commentsRepo = new CommentsRepository();
            LogworksRepository logworkRepo  = new LogworksRepository();

            model.CommentsPager     = model.CommentsPager ?? new PagerVM();
            model.CommentsFilter    = model.CommentsFilter ?? new CommentsFilterVM();
            model.CommentsFilter.Id = model.Id;
            var filter = model.CommentsFilter.BuildFilter();

            model.CommentsPager.Prefix       = "CommentsPager";
            model.CommentsFilter.Prefix      = "CommentsFilter";
            model.CommentsPager.ItemsPerPage = model.CommentsPager.ItemsPerPage == 0 ? 5 : model.CommentsPager.ItemsPerPage;
            model.CommentsPager.PageCount    = (int)Math.Ceiling(commentsRepo.Count(filter) / (decimal)model.CommentsPager.ItemsPerPage);
            model.CommentsPager.PageCount    = model.CommentsPager.PageCount == 0 ? 1 : model.CommentsPager.PageCount;
            model.Comments = commentsRepo.GetAll(filter, model.CommentsPager.CurrentPage, model.CommentsPager.ItemsPerPage);

            model.LogworksPager    = model.LogworksPager ?? new PagerVM();
            model.LogworkFilter    = model.LogworkFilter ?? new LogworkFilterVM();
            model.LogworkFilter.Id = model.Id;
            var logworkFilter = model.LogworkFilter.BuildFilter();

            model.LogworksPager.Prefix       = "LogworksPager";
            model.LogworkFilter.Prefix       = "LogworkFilter";
            model.LogworksPager.ItemsPerPage = model.LogworksPager.ItemsPerPage == 0 ? 5 : model.LogworksPager.ItemsPerPage;
            model.LogworksPager.PageCount    = (int)Math.Ceiling(logworkRepo.Count(logworkFilter) / (decimal)model.LogworksPager.ItemsPerPage);
            model.LogworksPager.PageCount    = model.LogworksPager.PageCount == 0 ? 1 : model.LogworksPager.PageCount;
            model.Logworks = logworkRepo.GetAll(logworkFilter, model.LogworksPager.CurrentPage, model.LogworksPager.ItemsPerPage);

            return(View(model));
        }