Пример #1
0
        public ActionResult Details(int id)
        {
            ReqUp r = new ReqUp();

            // Gets request with 'id'
            r.request = db.GetRequestById(id);
            // Gets account details for the logged in user
            Account acc = db.GetUserByName(User.Identity.Name);

            // If the user exists
            if (db.GetUserByName(User.Identity.Name) != null)
            {
                // Returns true if the user has upvoted the request
                r.upvoted = db.GetReqUpBool(id, acc.ID);
            }
            else
            {
                r.upvoted = false;
            }

            if (r != null)
            {
                return(View(r));
            }
            return(View("NotFound"));
        }