public async Task <ManufacturerCategoryMappingRemoveResponse> ManufacturerCategoryMappingRemove(ManufacturerCategoryMappingRemoveRequest request) { ManufacturerCategoryMappingRemoveResponse response = new ManufacturerCategoryMappingRemoveResponse(); try { var manufacturerCategory = new ManufacturerCategoryMappingModel { CategoryId = request.CategoryId, ManufacturerId = request.ManufacturerId }; var command = manufacturerCategory.ToRemoveCommand(); var result = await _manufacturerCategoryMappingService.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 ManufacturerCategoryMappingRemoveCommand ToRemoveCommand(this ManufacturerCategoryMappingModel manufacturerCategoryMapping) { if (manufacturerCategoryMapping == null) { return(null); } return(new ManufacturerCategoryMappingRemoveCommand() { ManufacturerId = manufacturerCategoryMapping.ManufacturerId, CategoryId = manufacturerCategoryMapping.CategoryId }); }