internal RateMusicalProject GetByUserAndProjectId(int musicalProjectId) { int userId = Utitilities.GetLoggedUserId(); RateMusicalProject retorno = _rateContributionBusiness.GetByUserAndProjectId(musicalProjectId, userId); return(retorno); }
internal RateMusician GetByOwnerId(int musician_target_id) { int musician_owner_id = Utitilities.GetLoggedUserId(); RateMusician retorno = _rateMusicianBusiness.GetByOwnerId(musician_target_id, musician_owner_id); return(retorno); }
public IEnumerable <MusicalProject> SearchByMusicalGenre(int musical_genre_id) { MusicalProjectRepository musicalProjectRepository = new MusicalProjectRepository(); int owner_id = Utitilities.GetLoggedUserId(); var retorno = musicalProjectRepository.SearchByMusicalGenre(musical_genre_id, owner_id); return(retorno); }
internal RateContribution GetByUserAndProjectId(int musicalProjectId) { int userId = Utitilities.GetLoggedUserId(); //TODO RateContribution retorno = new RateContribution();// _rateContributionBusiness.GetByUserAndProjectId(musicalProjectId, userId); return(retorno); }
internal IEnumerable <MusicalProject> MyProjects() { MusicalProjectBusiness musicalProjectBusiness = new MusicalProjectBusiness(); int owner_id = Utitilities.GetLoggedUserId(); IEnumerable <MusicalProject> projects = musicalProjectBusiness.GetProjectsByOwnerId(owner_id); return(projects); }
private void PopulateDefaultProperties(RateMusicalProject rateMusicalProject) { rateMusicalProject.musician_id = Utitilities.GetLoggedUserId(); }
private void PopulateDefaultProperties(MusicalProject musicalProject) { musicalProject.owner_id = Utitilities.GetLoggedUserId(); musicalProject.updated_at = DateTime.Now; }
internal Contribution Create() { Mock(); Contribution retorno = null; using (AudioHelper audioHelper = new AudioHelper()) { FileHandling(audioHelper); MusicalProjectRepository musicalProjectRepository = new MusicalProjectRepository(); MusicalProject musicalProject = musicalProjectRepository.Get(musical_project_id); MusicalProjectInstrumentBusiness musicalProjectInstrumentBusiness = new MusicalProjectInstrumentBusiness(); MusicalProjectInstrument musicalProjectInstrument = new MusicalProjectInstrument { instrument_id = instrument_id, is_base_instrument = base_instrument, musical_project_id = musical_project_id }; var projectInstruments = musicalProjectInstrumentBusiness.GetByMusicalProject(musical_project_id); musicalProjectInstrument = projectInstruments.Where(p => p.instrument_id == instrument_id).FirstOrDefault(); if (projectInstruments is null || musicalProjectInstrument == null) { musicalProjectInstrument = musicalProjectInstrumentBusiness.Create(musicalProjectInstrument); } timing = song.TotalTime.ToString(@"hh\:mm\:ss"); musician_id = Utitilities.GetLoggedUserId(); musical_genre_id = musicalProject.musical_genre_id; musical_project_instrument_id = musicalProjectInstrument.id; if (base_instrument) { status_id = eContributionStatus.Approved; type_id = eContributionType.PrivateContribution; } else { status_id = eContributionStatus.WaitingForApproval; type_id = contribution_type_id; } ContributionBusiness contributionBusiness = new ContributionBusiness(); var contributions = contributionBusiness.GetByMusicalProjectId(musical_project_id); var userContribution = contributions.Where(c => c.musician_id == musician_id && c.musical_project_instrument_id == musical_project_instrument_id).FirstOrDefault(); if (userContribution != null) { throw new ValidateException("You have already contribuited to this insturment on this project"); } retorno = contributionBusiness.Create(this); string keyName = string.Format("{0}{1}", retorno.id.ToString(), song.Extension); string audioPath = GetAudioPath(); string baseDirectory = AppDomain.CurrentDomain.BaseDirectory; string folderSave = Path.Combine(baseDirectory, "UploadedAudios"); musicalProjectInstrumentBusiness.SaveAudio(audioPath, folderSave, retorno.id); //audioHelper.UploadToAmazon(keyName); } return(retorno); }
private void PopulateDefaultProperties(RateMusician rateMusician) { rateMusician.musician_owner_id = Utitilities.GetLoggedUserId(); }
internal MusicalProject Create() { if (instruments.Length < 1) { throw new ValidateException("É necessário ter no mínimo um instrumento!"); } if (base_instrument_id == 0) { throw new ValidateException("É necessário preencher o instrumento base!"); } MusicalProjectBusiness musicalProjectBusiness = new MusicalProjectBusiness(); var retorno = musicalProjectBusiness.Create(this); MusicalProjectInstrumentBusiness musicalProjectInstrumentBusiness = new MusicalProjectInstrumentBusiness(); MusicalProjectInstrument baseMusicalProjectInstrument = new MusicalProjectInstrument(); foreach (var item in instruments) { MusicalProjectInstrument musicalProjectInstrument = new MusicalProjectInstrument() { instrument_id = item, musical_project_id = retorno.id, is_base_instrument = item == base_instrument_id }; var tempMusicalProjectInstrument = musicalProjectInstrumentBusiness.Create(musicalProjectInstrument); if (item == base_instrument_id) { baseMusicalProjectInstrument = tempMusicalProjectInstrument; } } string baseDirectory = AppDomain.CurrentDomain.BaseDirectory; string audioPath = string.Empty; int idBaseMusicalProjectInstrument = baseMusicalProjectInstrument.id; ContributionModel contributionModel = new ContributionModel() { instrument_id = baseMusicalProjectInstrument.instrument_id, base_instrument = true, musical_project_id = retorno.id, musical_genre_id = retorno.musical_genre_id, musician_id = Utitilities.GetLoggedUserId(), }; contributionModel.Create(); //if (instruments.Any(i => i == (int)EInstruments.Lead_Guitar || i == (int)EInstruments.Rhythm_Guitar)) //{ // audioPath = Path.Combine(baseDirectory, "PlaceholderAudio\\guitar.mp3"); //} //else if (instruments.Any(i => i == (int)EInstruments.Piano)) //{ // audioPath = Path.Combine(baseDirectory, "PlaceholderAudio\\synth.mp3"); //} //else //{ // throw new NotImplementedException(); //} //string folderSave = Path.Combine(baseDirectory, "UploadedAudios"); //musicalProjectInstrumentBusiness.SaveAudio(audioPath, folderSave, idBaseMusicalProjectInstrument); return(retorno); }