public ActionResult Index() { IEnumerable <SampleDTO> sampleDtos = _sampleService.GetSamples(); var samples = new SamplesListViewModel { Samples = _mapper.Map <IEnumerable <SampleDTO>, List <SampleViewModel> >(sampleDtos), SamplesAmount = _sampleService.GetSampleEntriesAmout(CurrentUser.IsAdmin) }; return(View(samples)); }
public PartialViewResult SampleRequests(PromoListViewModel obj) { var viewModel = new SamplesListViewModel(); viewModel.UserId = obj.UserId; viewModel.Search = obj.Search; viewModel.FilteredId = obj.FilteredId; viewModel.role = ""; if (User.IsInRole("admin") || User.IsInRole("seeAllUsers")) { viewModel.role = "seeAllUsers"; } var model = PromoMovementRep.FindBy(viewModel.predicate).OrderByDescending(i => i.op_date).ToList(); if (obj.OrderParameter != null) { model = Ordering.OrderBy <PromoMovement>(model, obj.OrderParameter, obj.OrderDir).ToList(); } return(PartialView(model)); }