public async Task<ActionResult> Index(int? pageIndex, int? pageSize, string projectId)
		{
			ProjectsRepository repository = new ProjectsRepository();
			ProjectListViewModel model = new ProjectListViewModel();

			if (pageIndex == null) { model.PageIndex = 0; }
			else { model.PageIndex = (int)pageIndex; }

			if (pageSize == null) { model.PageSize = 10; }
			else { model.PageSize = (int)pageSize; }

			try
			{
				SPListConfig cfg = new SPListConfig();
				await cfg.ConfigureSharePoint();

				var r = await repository.GetProjects(model.PageIndex, model.PageSize);
				model.Projects = r.ToList();
			}
			catch (RedirectRequiredException x)
			{
				return Redirect(x.RedirectUri.ToString());
			}
			return View(model);
		}
Esempio n. 2
0
        public async Task <ActionResult> Index(int?pageIndex, int?pageSize, string projectId)
        {
            ProjectsRepository   repository = new ProjectsRepository();
            ProjectListViewModel model      = new ProjectListViewModel();

            if (pageIndex == null)
            {
                model.PageIndex = 0;
            }
            else
            {
                model.PageIndex = (int)pageIndex;
            }

            if (pageSize == null)
            {
                model.PageSize = 10;
            }
            else
            {
                model.PageSize = (int)pageSize;
            }

            try
            {
                SPListConfig cfg = new SPListConfig();
                await cfg.ConfigureSharePoint();

                var r = await repository.GetProjects(model.PageIndex, model.PageSize);

                model.Projects = r.ToList();
            }
            catch (RedirectRequiredException x)
            {
                return(Redirect(x.RedirectUri.ToString()));
            }
            return(View(model));
        }