// TODO: Repository to be added at the later stage #region Public Methods public List <Customer> GetCustomers() { var customers = new List <Customer>(); if (string.IsNullOrEmpty(_yamlFileOptions.FilePath)) { return(null); } var items = YamlFileUtility.ReadYamlFile(_yamlFileOptions.FilePath, "customers"); foreach (var yamlNode in items) { var item = (YamlMappingNode)yamlNode; var customer = new Customer { Id = YamlHelper.ConvertYamlScalarNodeToString(item, "id"), Name = YamlHelper.ConvertYamlScalarNodeToString(item, "name"), NumEmployees = Convert.ToInt16(YamlHelper.ConvertYamlScalarNodeToString(item, "num_employees")), Tags = YamlHelper.ConvertYamlScalarNodeToStingList(item, "tags") }; customers.Add(customer); } return(customers); }
// TODO: Repository to be added at the later stage #region Public Methods public bool Login(Login criteria) { if (string.IsNullOrEmpty(_yamlFileOptions.FilePath)) { return(false); } var items = YamlFileUtility.ReadYamlFile(_yamlFileOptions.FilePath, "auth"); foreach (var yamlNode in items) { var item = (YamlMappingNode)yamlNode; if (YamlHelper.ConvertYamlScalarNodeToString(item, "password") == criteria.Password && YamlHelper.ConvertYamlScalarNodeToString(item, "username") == criteria.Username) { return(true); } } return(false); }