public ActionResult Index(int?page, string vl, string prm = null)
        {
            UserPhoneRepository repository = new UserPhoneRepository();

            try
            {
                Search search = new Search();

                search = SetValue(page, vl, prm);

                int pageSize   = 15;
                int pageNumber = (page ?? 1);

                UserPhoneVM viewModel = new UserPhoneVM();
                viewModel.Search = search;

                viewModel.Search.pageSize   = pageSize;
                viewModel.Search.pageNumber = pageNumber;

                viewModel.RUserPhoneList = repository.SW_GetUserPhonesDTO(viewModel.Search);

                viewModel.ListCount = repository.SW_GetUserPhonesDTOCount(viewModel.Search);
                int[] pc = new int[viewModel.ListCount];

                viewModel.Paging = pc.ToPagedList(pageNumber, pageSize);



                return(Request.IsAjaxRequest()
              ? (ActionResult)PartialView("PartialIndex", viewModel)
              : View(viewModel));
            }
            catch (Exception ex)
            {
                return(View("Error", new HandleErrorInfo(ex, "Error", "Error")));
            }
        }
Exemple #2
0
        public UserPhoneRepositoryTests()
        {
            var mockContext = Mock.Create <IVoyageDataContext>();

            _phoneRepository = new UserPhoneRepository(mockContext.Object);
        }