public XDocument ReadXml() { var xDocument = new XDocument(); var xElement = new XElement("Products"); var xAttributes = ProductDataProvider.GetProducts() .Select(m => new XElement("Product", new XAttribute("Description", m.Name), new XAttribute("Price", m.Price))); xElement.Add(xAttributes); xDocument.Add(xElement); return(xDocument); }
public async Task <IEnumerable <Products> > List() { _logger.LogDebug("Get all products."); try { return(await _dataProvider.GetProducts()); } catch (Exception ex) { _logger.LogError("An error occured. Check stacktrace below: \n\n" + ex.StackTrace); throw ex; } }