public static MvcHtmlString RenderStudAdmin(this HtmlHelper helper, BlockUnblockStudentsViewModel model) { StringBuilder builder = new StringBuilder(); if (model.UnblockStudents.ToList().Count > 0) { builder.Append(helper.Partial("_UnblockedUsers", model.UnblockStudents)); } if (model.BlockStudents.ToList().Count > 0) { builder.Append(helper.Partial("_BlockedUsers", model.BlockStudents)); } return(MvcHtmlString.Create(builder.ToString())); }
public ActionResult Students() { var unblockStudentsDto = _studentService.GetUnblockStudents(); var unblockStudentsViewModel = _mapper.Map <List <UserViewModel> >(unblockStudentsDto); var blockStudentsDto = _studentService.GetBlockStudents(); var blockStudentsViewModel = _mapper.Map <List <UserViewModel> >(blockStudentsDto); var model = new BlockUnblockStudentsViewModel() { UnblockStudents = unblockStudentsViewModel, BlockStudents = blockStudentsViewModel }; return(View(model)); }