public async Task <IActionResult> Index(int page = 1, string Name = null, DateTime?StartDate = null, DateTime?EndDate = null) { var model = new PermissionsGroupsViewModel { Name = Name , StartDate = StartDate.HasValue ? ConvertDatetime.ConvertToGregorianDate(StartDate.Value) : StartDate , EndDate = EndDate.HasValue ? ConvertDatetime.ConvertToGregorianDate(EndDate.Value) : EndDate }; var permissionGroups = await permissionsGroupService.Search(Name, StartDate, EndDate); //if (permissionGroups.Count > 0) //{ // var List = mapper.Map<List<PermissionsGroupsViewModel>>(permissionGroups); // model.PermissionsGroupsList = List.ToPagedList(page, Constants.PageSize); //} var List = mapper.Map <List <PermissionsGroupsViewModel> >(permissionGroups); model.PermissionsGroupsList = List.ToPagedList(page, Constants.PageSize); await model.FillLists(sessionService, adminsService); ViewBag.sessionService = sessionService; return(View(model)); }
public async Task <ActionResult> Create() { var model = new PermissionsGroupsViewModel(); await model.FillLists(sessionService, adminsService); return(View(model)); }