예제 #1
0
        public async Task <Entities.Application.Song> AddSong(Entities.Application.Song song)
        {
            var converted = _mapper.ToDbEntity(song);
            var dbResult  = await _dao.AddSong(converted);

            return(_mapper.ToApplicationEntity(dbResult));
        }
예제 #2
0
 public DataAccess.Firestore.Model.Song ToDbEntity(Entities.Application.Song entity)
 {
     var reference = _db.Collection(COLLECTION_REF).Document(entity.Id);
     return new DataAccess.Firestore.Model.Song
     {
         Reference = reference,
         Name = entity.Name,
         Artists = entity.Artists.Select(a => new DataAccess.Firestore.Model.Artist { Id = a.Id, Name = a.Name }).ToList()
     };
 }
예제 #3
0
        public async Task <bool> RecognizeSong(string establishmentId, Entities.Application.Song song, string userId)
        {
            var place = await _dao.GetPlace(establishmentId);

            if (place == null)
            {
                return(false);
            }
            var res = await songService.RecognizeSong(establishmentId, song, userId);

            if (res != null)
            {
                return(true);
            }
            return(false);
        }
예제 #4
0
        public async Task <Entities.Application.Song> RecognizeSong(string establishmentId, Entities.Application.Song song, string userId)
        {
            var converted = _mapper.ToDbEntity(song, establishmentId);
            var dbResult  = await _dao.RecognizeSong(converted, userId);

            var result = _mapper.ToApplicationEntity(dbResult);

            return(result);
        }