public async Task <AttrCategoryRemoveResponse> AttrCategoryRemove(AttrCategoryRemoveRequest request) { AttrCategoryRemoveResponse response = new AttrCategoryRemoveResponse(); try { var attrCategory = new AttrCategoryModel { AttributeId = request.AttributeId, CategoryId = request.CategoryId }; var command = attrCategory.ToRemoveCommand(); var result = await _attrCategoryService.SendCommand(command); if (result.IsSucess) { response.SetSucess(); } else { response.SetFail(result.Message); } } catch (Exception e) { response.SetFail(e); _logger.LogError(e, e.Message, request); } return(response); }
public static AttrCategoryRemoveCommand ToRemoveCommand(this AttrCategoryModel attrCategory) { if (attrCategory == null) { return(null); } return(new AttrCategoryRemoveCommand() { AttributeId = attrCategory.AttributeId, CategoryId = attrCategory.CategoryId, }); }
public static AttrCategoryChangeCommand ToChangeCommand(this AttrCategoryModel attrCategory) { if (attrCategory == null) { return(null); } return(new AttrCategoryChangeCommand() { AttributeId = attrCategory.AttributeId, CategoryId = attrCategory.CategoryId, AttributeType = attrCategory.AttributeType, DisplayOrder = attrCategory.DisplayOrder, BaseUnitId = attrCategory.BaseUnitId, IsRequired = attrCategory.IsRequired, IsFilter = attrCategory.IsFilter, FilterSpan = attrCategory.FilterSpan ?? "" }); }