Пример #1
0
        public async Task <IActionResult> Get(long id)
        {
            try
            {
                var bookViewModelResult = await _bookAppService.GetByIdAsync(id);

                if (bookViewModelResult?.Data == null)
                {
                    return(NotFound(new { message = "A problem occurred during getting the data." }));
                }

                return(Ok(bookViewModelResult.Data));
            }
            catch (ExceptionHandler exceptionHandler)
            {
                return(ResponseByHttpStatusCode(exceptionHandler));
            }
        }
        public async Task <ActionResult> Detail(int bookId)
        {
            var input = new BookInput
            {
                Id       = bookId,
                PageSize = GetDefaultPageSize()
            };

            if (await IsGrantedAsync(PermissionNames.ContentChange))
            {
                CurrentUnitOfWork.DisableFilter(AbpDataFilters.SoftDelete, FilterNames.Approved);
            }

            var output = await _bookservice.GetByIdAsync(input);

            var model = output.MapTo <DetailBookViewModel>();

            if (Request.IsAjaxRequest())
            {
                return(PartialView("_Detail", model));
            }
            return(View("Detail", model));
        }