예제 #1
0
        public void SetRatingToCreative(int rating, CreativeViewModel creativemodel, string userId)
        {
            ApplicationUser user           = UsersRepository.FindUserById(userId);
            bool            isUserNotVoted = IsUserNotVoted(user, creativemodel.Id);

            if (isUserNotVoted)
            {
                Creative creative  = dataBaseContext.Creatives.Find(creativemodel.Id);
                Rating   ratingObj = InitRating(creative, rating, user);
                CalculateRating(ratingObj, creative);
            }
        }
예제 #2
0
 public void GetRatingFromView(int rating, CreativeViewModel creative)
 {
     CreativeService.SetRatingToCreative(rating, creative, User.Identity.GetUserId());
 }
예제 #3
0
        private Creative InitCreative(CreativeViewModel creativemodel, ApplicationUser user)
        {
            Creative creative = dataBaseContext.Creatives.Find(creativemodel.Id);

            return(creative);
        }