Exemplo n.º 1
0
    //Get cooking article user rating
    private void GetUserCookingArticleRating()
    {
        //Instantiate user article cookie rating object
        CookieRating GetCookie = new CookieRating(constant.intArticle, Article.ID, PlaceHolder2);

        //Get the user rating cookie
        GetCookie.GetUserCookieRating();

        //Release allocated memory
        GetCookie = null;
    }
Exemplo n.º 2
0
    //Get recipe user cookie rating
    private void GetUserRecipeCookieRating()
    {
        //Instantiate user cookie rating object
        CookieRating GetCookie = new CookieRating(constant.intRecipe, Recipe.ID, PlaceHolder1);

        //Get the user rating cookie
        GetCookie.GetUserCookieRating();

        //Release allocated memory
        GetCookie = null;
    }
Exemplo n.º 3
0
        public async Task <CookieRating> AddRatings(int userId, int cookieId, int rating)
        {
            var cookieRating = new CookieRating()
            {
                CookieID = cookieId, UserID = userId, Rating = rating
            };

            using (CookieShopDbContext context = _contextFactory.CreateDbContext())
            {
                var newRating = await context.CookieRatings.AddAsync(cookieRating);

                context.SaveChanges();
                return(newRating.Entity);
            }
        }