// GET: Calendar
        public ActionResult Index(string[] selectedServiceTypes, string allTypes = "false", int year = Constants.DefaultYear)
        {
            ViewBag.Year = year;
            bool allFlags;

            bool.TryParse(allTypes, out allFlags);

            var audits =
                db.Audits.Where(item =>
                                (item.LastAuditDate != null && item.LastAuditDate.Value.Year == year) ||
                                item.PlannedDate.Year == year).Include(a => a.Project);

            var resultCheckedServiceTypes = HelperForProject.GetResultCheckedServiceTypes(selectedServiceTypes, allFlags);

            ViewBag.CheckedServiceTypes = resultCheckedServiceTypes;

            if (resultCheckedServiceTypes.Any())
            {
                //var selectedTypes = projectTypesForView.Where(item => item.Value.Equals(Constants.Checked)).Select(item => item.Key.ParseAsEnum<ServiceTypes>()).ToList();
                audits = audits.Where((item) => resultCheckedServiceTypes.Contains(item.ServiceType));
            }
            else
            {
                audits = audits.Where(item => item.AuditId == 0);
            }

            return(View(audits));
        }
        // GET: Projects
        public ActionResult Index(string sortOrder, string searchString)
        {
            ViewBag.NameSortParm = string.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewBag.DateSortParm = sortOrder == "Date" ? "date_desc" : "Date";

            var projects = from s in db.Projects select s;

            if (!string.IsNullOrEmpty(searchString))
            {
                projects = projects.Where(s => s.Name.Contains(searchString));
            }

            var audits = from s in db.Audits select s;

            var projectView = HelperForProject.CreateProjectView(projects.ToList(), audits.ToList());

            switch (sortOrder)
            {
            case "name_desc":
                projectView = projectView.OrderByDescending(s => s.Project.Name);
                break;

            //case "Date":
            //    projects = projects.OrderBy(s => s.PlannedDate);
            //    break;
            //case "date_desc":
            //    projects = projects.OrderByDescending(s => s.PlannedDate);
            //    break;
            default:
                projectView = projectView.OrderBy(s => s.Project.Name);
                break;
            }

            ViewBag.IsCreateEnable = AccessUtility.IsCreateEnable(db, User.Identity.Name);
            return(View(projectView.ToList()));
        }