Пример #1
0
        //
        // GET: /Home/
        public ActionResult Index(int year = 0, int month = 0, int day = 0, int id = 0)
        {
            if (year == 0)
            {
                return(View(_repository.All()));
            }

            if (id > 0)
            {
                var posts = _repository.FindByDate(year, month, day);

                return(View(posts.Where(p => p.Id == id)));
            }

            if (day > 0)
            {
                return(View(_repository.FindByDate(year, month, day)));
            }

            if (month > 0)
            {
                return(View(_repository.FindByDate(year, month)));
            }

            return(View(_repository.FindByDate(year)));
        }