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); } }
public void GetRatingFromView(int rating, CreativeViewModel creative) { CreativeService.SetRatingToCreative(rating, creative, User.Identity.GetUserId()); }
private Creative InitCreative(CreativeViewModel creativemodel, ApplicationUser user) { Creative creative = dataBaseContext.Creatives.Find(creativemodel.Id); return(creative); }