public GetBrochureViewModel GetAll() { var brochureEntities = _brochureRepository.GetAll(); var brochureViews = new GetBrochureViewModel(); brochureViews.Brochures = Mapper.Map <IEnumerable <Brochure>, List <GetBrochureViewItem> >(brochureEntities); return(brochureViews); }
public GetBrochureViewModel Get(long id) { var brochure = _brochureRepository.Get(id); if (brochure == null) { throw new BusinessLogicException("Brochure not found"); } var result = new GetBrochureViewModel() { Id = brochure.Id, Name = brochure.Name, TypeOfCover = brochure.TypeOfCover, NumberOfPages = brochure.NumberOfPages }; return(result); }
public IActionResult Get() { GetBrochureViewModel brochureList = _brochureService.GetAll(); return(Ok(brochureList)); }