/* public ActionResult<List<Book>> Get() => * _chapterService.Get(); */ public async Task <IEnumerable <ChapterViewModel> > GetAllChapters() { var books = await _chapterService.GetAllChapters(); var result = mapper.Map <List <Chapter>, IEnumerable <ChapterViewModel> >(books); return(result); }
private void HandleRequest() { Tools.ParseRequestStr(RequestStr, ref requestCode, ref requestData); ChapterService.ReturnFromServiceSignal.AddListener(HandleResponse); if (requestCode == ChapterEvent.GetAllChapters) { ChapterService.GetAllChapters(); } }
public async Task <ApiResponse <IEnumerable <Chapter> > > GetAllChapters() { try { return(await _chapterService.GetAllChapters()); } catch (Exception ex) { return(new ApiResponse <IEnumerable <Chapter> >() { Success = false, Errors = new List <string>() { ex.Message } }); } }