public async Task <AttrCategoryGetResponse> AttrCategoryGet(AttrCategoryGetRequest request) { AttrCategoryGetResponse response = new AttrCategoryGetResponse(); try { var attrCategory = await _attrCategoryService.Get(request.AttributeId, request.CategoryId); if (attrCategory == null) { response.SetFail(BaseResponse.ErrorCodeEnum.UserNotFound); return(response); } response.AttrCategory = attrCategory.ToModel(); RProductAttribute[] productAttributes = await _attrCategoryService.GetsProductAttr(request.CategoryId); response.ProductAttributes = productAttributes?.Select(p => p.ToModel()).ToArray(); } catch (Exception e) { response.SetFail(e); _logger.LogError(e, e.Message, request); } return(response); }
public async Task <IActionResult> Get([FromBody] AttrCategoryGetRequest request) { try { var response = await _attrCategoryAppService.AttrCategoryGet(request); return(Json(response)); } catch (Exception e) { _logger.LogError(e, Common.Common.GetMethodName()); throw; } }