コード例 #1
0
        //FOR ABOVE METHOD, MADE BCS OF AN ERROR;

        /*
         * The instance of entity type 'Rating' cannot be tracked because another
         * instance with the key value '{Id: x}' is already being tracked
         */
        public bool DeleteRatingFromDB(int userid, string titleid)
        {
            using var ctx = new ImdbContext();
            var dbRating = GetMovieRatingFromUser(userid, titleid);

            ctx.Remove(dbRating);
            ctx.SaveChanges();
            return(true);
        }