public async Task <ActionResult> CBTContentList(GetCBTContentListInput input) { var output = await _eClassAppService.GetCBTContentList(input); var model = new CBTContentListViewModel(output.Items); return(View("CBTContentList", model)); }
public async Task <ListResultDto <CBTContentDto> > GetCBTContentList(GetCBTContentListInput input) { var cbtContentList = await _cbtContentRepository .GetAll() .Include(t => t.Categories) .Include(t => t.ContentType) .Include(c => c.CBTContentOption) .ToListAsync(); var categoryList = await _categoryRepository.GetAllListAsync(); var contentType = await _contentTypeRepository.GetAllListAsync(); var cbtList = from ccl in cbtContentList join cl in categoryList on ccl.CategoryId equals cl.Id join ct in contentType on ccl.ContentTypeId equals ct.Id join pccl in cbtContentList on ccl.PrecedingCBTContentId equals pccl.Id into pclE from pccl in pclE.DefaultIfEmpty() select new CBTContentDto { CBTContentId = ccl.Id, PrecedingCBTContentId = ccl.PrecedingCBTContentId, PrecedingCBTContentCode = pccl?.Code, Code = ccl.Code, Description = ccl.Description.Substring(0, ccl.Description.Length > 50 ? 50 : ccl.Description.Length) + (ccl.Description.Length > 50 ? "..." : ""), Required = ccl.Required, OnlyNumericValue = ccl.OnlyNumericValue, IncludeComment = ccl.IncludeComment, Comment = ccl.Comment, AllowMultipleChoice = ccl.AllowMultipleChoice, CategoryId = ccl.CategoryId, CategoryName = cl.CategoryName, ContentTypeId = ccl.ContentTypeId, ContentName = ct.ContentName, CBTContentOrder = ccl.CBTContentOrder }; return(new ListResultDto <CBTContentDto>( ObjectMapper.Map <List <CBTContentDto> >(cbtList) )); }