Ejemplo n.º 1
0
        public LibraryInfo Create(string userId, LibraryType type, string path, string username, string password)
        {
            var guid = Guid.Parse(userId);

            var dbLibrary = new DbLibrary
            {
                Id = Guid.NewGuid(),
                Path = path,
                Username = username,
                Password = password,
                Type = type,
                UserId = guid,
            };

            this._db.Libraries.Add(dbLibrary);
            this._db.SaveChanges();

            return dbLibrary.ToModel();
        }
Ejemplo n.º 2
0
        private string GetName(DbLibrary library)
        {
            switch (library.Type)
            {
                case LibraryType.SharedFolder:
                    return library.Path;

                case LibraryType.GoogleMusic:
                    return library.Username;

                default:
                    throw new NotImplementedException();
            }
        }