예제 #1
0
        public void CanReview()
        {
            var sql  = new ReviewSqlContext();
            var repo = new ReviewRepository(sql);

            bool result = repo.CanReview(1045, 1042);
        }
예제 #2
0
        //Get /Details/{id}
        public ActionResult Details(int id)
        {
            if (!AuthRepository.CheckIfUserCanAcces(GebruikerType.All, (Gebruiker)Session["LoggedInUser"]))
            {
                return(View("~/Views/Error/AuthError.cshtml"));
            }

            //  try {
            GebruikerSqlContext gsc = new GebruikerSqlContext();
            GebruikerRepository gr  = new GebruikerRepository(gsc);

            ReviewSqlContext rsc = new ReviewSqlContext();
            ReviewRepository rr  = new ReviewRepository(rsc);

            Gebruiker loggedUser = (Gebruiker)Session["LoggedInUser"];

            ViewBag.SelectedUser = gr.GetById(id);

            if (loggedUser != null)
            {
                ViewBag.CanReview = rr.CanReview(loggedUser.Id, id);
            }

            ViewBag.SelectedUser = gr.GetById(id);
            ViewBag.Reviews      = rr.GetReviewByVrijwilligerId(id);
            return(View("~/Views/Gebruiker/Details.cshtml"));
            // }

            /*
             * catch (Exception e)
             * {
             *  return RedirectToAction("Index", "Error");
             * }
             */
        }