public ActionResult Details(long goodId)
 {
     try
     {
         var store = new StoreAction();
         var good  = store.GetGoodInfo(goodId);
         var model = new GoodDetailsViewModel(good);
         model.feedbacks       = store.GetFeedBack(goodId);
         model.canSendFeedback = Session.IsAuth() && !model.feedbacks.Any(s => s.userId == Session.GetUserId());
         if (Session.IsAuth())
         {
             var customer = new CustomerAction(Session.GetUserId());
             customer.SetThatWatching(goodId);
         }
         SetPratentGroupLinks(good.groupId);
         (ViewBag.Links as Queue <Link>).Enqueue(new Link {
             description = good.name, url = $"~/Details/{good.groupId}/{good.id}"
         });
         return(View(model));
     }
     catch (Exception ex)
     {
         HttpContext.Response.Redirect("/Error/_404", true);
         return(null);
     }
 }
示例#2
0
        private void TestWatchGood(int userId)
        {
            var customer = new CustomerAction(userId);
            var goodId   = rand.Next(12) + 1;

            if (goodId == 8)
            {
                goodId = 1;
            }
            customer.SetThatWatching(goodId);
        }