예제 #1
0
        public void AddSongToPlaylist(int songId, int playlistId)
        {
            var playlistSongEntity = new PlaylistSong
            {
                PlaylistId = playlistId,
                SongId     = songId
            };

            context.PlaylistSong.Add(playlistSongEntity);
            context.SaveChanges();
        }
예제 #2
0
        public IActionResult AddNewComment(int songId, CommentModel model)
        {
            var newRating = new Rating
            {
                Points       = model.Rating,
                Comment      = model.Comment,
                CreationDate = DateTime.Now,
                SongId       = songId,
                UserId       = 1
            };

            _context.Rating.Add(newRating);
            _context.SaveChanges();

            return(Ok());
        }
예제 #3
0
        public IActionResult BlockUser(int userId)
        {
            var user = _context.User
                       .FirstOrDefault(userid => userid.UserProfileId == userId);

            user.UserRoleId = 4;

            _context.User.Add(user);
            _context.SaveChanges();

            return(Ok());
        }
예제 #4
0
        public IActionResult AddNewArtist(ArtistModel model)
        {
            var newArtist = new Artist
            {
                Name        = model.Name,
                FullName    = model.FullName,
                Birthdate   = DateTime.Now, //Convert.ToDateTime(model.Birthdate),
                Description = model.Description,
                OriginDate  = DateTime.Now, //Convert.ToDateTime(model.OriginDate),
                UserId      = 1
            };

            var addedEntity = _context.Artist.Add(newArtist);

            _context.SaveChanges();

            return(Ok());
        }