Пример #1
0
        public IActionResult Detail(string buildId)
        {
            PcBuildDetailViewModel model = new PcBuildDetailViewModel
            {
                Build   = _pcBuildLogic.GetBuild(buildId),
                Account = _pcBuildLogic.GetUserFromBuild(buildId)
            };

            if (User.Identity is ClaimsIdentity claimsIdentity && User.Identity.IsAuthenticated)
            {
                var userId = GetUserId();

                model.Liked    = _likeLogic.GetLikeFromUser(buildId, userId);
                model.Disliked = _likeLogic.GetDislikeFromUser(buildId, userId);
            }
            model.Build.Id = buildId;

            return(View(model));
        }
Пример #2
0
 public void TestSubmitLike()
 {
     _logic.SubmitLike(_build, _account.Id);
     Assert.IsTrue(_logic.GetLikeFromUser(_build.Id, _account.Id) && !_logic.GetDislikeFromUser(_build.Id, _account.Id));
 }