using System; using System.Collections.Generic; using System.Linq; using zero.Core.Entities; using zero.Core.Options; namespace zero.Core.Api { public class SectionsApi : ISectionsApi { protected IZeroOptions Options { get; private set; } public SectionsApi(IZeroOptions options) { Options = options; } /// public IReadOnlyCollection GetAll() { return Options.Sections.GetAllItems(); } /// public ISection GetByAlias(string alias) { return Options.Sections.GetAllItems().FirstOrDefault(section => section.Alias.Equals(alias, StringComparison.InvariantCultureIgnoreCase)); } } public interface ISectionsApi { /// /// Get all available backoffice sections /// IReadOnlyCollection GetAll(); /// /// Get backoffice section by alias /// ISection GetByAlias(string alias); } }