Ejemplo n.º 1
0
        public void AddSong(UploadSongBindingModel model,
                            string audioFileName, string coverFileName)
        {
            Song song = Mapper.Instance.Map <UploadSongBindingModel, Song>(model);

            song.Uploader      = context.Users.Find(HttpContext.Current.User.Identity.GetUserId());
            song.AudioFileName = audioFileName;
            song.ImageFileName = coverFileName;
            song.UploadDate    = DateTime.Now;
            song.Genre         = this.context.Genres.Find(model.GenreId);

            context.Songs.Add(song);
            context.SaveChanges();
        }
Ejemplo n.º 2
0
        public void CreateGenre(CreateGenreBindingModel model)
        {
            var genre = Mapper.Instance.Map <CreateGenreBindingModel, Genre>(model);

            context.Genres.Add(genre);
            context.SaveChanges();
        }