public ActionResult <Song> GetOne(long id) { Debug.WriteLine($"{MethodBase.GetCurrentMethod().Name} requested"); var song = _songManager.Get(id); return(new ActionResult <Song>(song)); }
public void AddRating(Rating rating) { var song = _songRepository.Get(rating.Song.SongId); var user = _userRepository.Get(rating.User.UserId); rating.Song = null; rating.User = user; song.Ratings.Add(rating); song.CalculateAverageRating(); _songRepository.SaveChanges(); }
public void AddSongToUser(UserSong userSong) { var userToUpdate = _userRepository.Get(userSong.User.UserId); var songToUpdate = _songRepository.Get(userSong.SongId); userSong.User = null; userToUpdate.UserSongs.Add(userSong); songToUpdate.IsAttached = true; _songRepository.SaveChanges(); _userRepository.SaveChanges(); }
public IEnumerable <Song> SearchLocalSongs(string value) { var songs = _songRepository.Get(); var query = new MusicEntityPartialSearchQuery(); return(query.AsExpression(songs, value)); }
public Album GetBySong(long songId) { Debug.WriteLine($"{MethodBase.GetCurrentMethod().Name} requested with songId{songId}"); var song = _songManager.Get(songId); return(_albumManager.GetBySong(song)); }
public IActionResult GetSongs() { var songResponse = new SongResponse(); try { var songs = _songRepository.Get(); var results = Mapper.Map <IEnumerable <SongDto> >(songs); songResponse.Songs = results; return(Ok(songResponse)); } catch (Exception ex) { songResponse.AlertMessage = ex.Message; return(BadRequest(songResponse)); } }
public async Task <ServiceResult <SongModel> > Get(string id) { var serviceResult = new ServiceResult <SongModel>(); var result = await _songRepository.Get(id); if (result.Success) { serviceResult.Success = true; serviceResult.Result = result.Entity; } else { serviceResult.Error.Code = ErrorStatusCode.BudRequest; serviceResult.Error.Description = result.Message; } return(serviceResult); }
public void AddMusicianToSong(int songId, MusicianRegisterViewModel musician) { var recordingId = _songRepository.Get(s => s.id == songId).recordingid; _recordingPartyRepository.Add(new recording_party { recordingid = recordingId, partyrealid = musician.PartyRealId, rolecode = musician.Role.RoleCode, instrumentcode = musician.Instrument.IdCode, updatedby = "User", // Replace with user updatedon = DateTime.Now, createdby = "User", createdon = DateTime.Now, status = 2 }); _unitOfWork.Commit(); }
public Song Put(int id, SongDTO value) { Song model = ISongRepository.Get(id); if (value.Name != null) { model.Name = value.Name; } if (value.FitnessClassId != 0) { model.FitnessClassId = value.FitnessClassId; } if (value.Singer != null) { model.Singer = value.Singer; } if (value.Bpm != 0) { model.Bpm = value.Bpm; } return(ISongRepository.Update(model)); }
public IList <GetSongsQuery> Get() { return(_songRepository.Get()); }
public Song Delete(int id) { Song model = ISongRepository.Get(id); return(ISongRepository.Delete(model)); }
public ActionResult <Song> Get(int id) { return(ISongRepository.Get(id)); }
// GET: SongsController/Details/5 public ActionResult Details(int id) { return(View(_songRepository.Get(id))); }