/// <summary> /// Get Brand information /// </summary> /// <param name="brandId"></param> /// <returns></returns> public Brand GetBrand(int brandId) { _logger.LogInformation($"BEGIN GetBrand"); try { var brand = _brandRepository.GetBrand(brandId); if (brand == null) { return(null); } var result = new Brand { Id = brand.BrandId, Name = brand.Name, Modified = brand.Brand.Modified, VirtualName = brand.Name.RemoveDiacritics() }; return(result); } catch (Exception ex) { _logger.LogError($"Exception on GetBrand with message: {ex.Message}"); return(null); } }
private IEnumerable <Brand> MapBrands(IEnumerable <BrandMultilingual> brands) { var collection = new List <Brand>(); foreach (var brand in brands) { var result = new Brand { Id = brand.BrandId, Name = brand.Name, Modified = brand.Brand.Modified, VirtualName = brand.Name.RemoveDiacritics() }; collection.Add(result); } return(collection.Count == 0 ? null : collection); }