// GET: UserPortfolio
        public ActionResult Registration()
        {
            HttpCookie cookie = GetPortfolioCookie();
            int        id     = Convert.ToInt32(EncryptionDecryption.DecryptString(Request.QueryString["id"]));

            if (id <= 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            else if (db.tblPortfolios.SingleOrDefault(P => P.PortfolioID == id).IsActive == false)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            else
            {
                if (cookie != null)
                {
                    Session["PUEmail"]       = cookie["PUEmail"];
                    Session["PUPhoneNumber"] = cookie["PUPhoneNumber"];
                    Session["PUName"]        = cookie["PUName"];
                    ViewBag.BannerImage      = getRandomBanner();
                    _PortfolioID             = id;
                    return(View("Index", db.tblbanners.ToList()));
                }

                ViewBag.BannerImage = getRandomBanner();
                _PortfolioID        = id;
                return(View("Registration"));
            }
        }
        public async Task <HttpResponseMessage> ExecuteAuthorizationFilterAsync(HttpActionContext actionContext, CancellationToken cancellationToken, Func <Task <HttpResponseMessage> > continuation)
        {
            //get request information from request.
            var requestInfo = actionContext.Request.GetRequestInfo();

            if (requestInfo != null)
            {
                ContextOperator.Set(ContextKeys.REQUEST_INFO_KEY, requestInfo);
            }

            if (SkipAuthorization(actionContext))
            {
                return(await continuation());
            }

            //read session id from request header.
            var sessionId = actionContext.Request.GetSessionId();

            if (!string.IsNullOrEmpty(sessionId))
            {
                //Decrypt sessionId.
                sessionId            = EncryptionDecryption.DecryptString(sessionId, AppSettingManager.Password, AppSettingManager.Salt);
                this._sessionService = GlobalConfiguration.Configuration.DependencyResolver.GetService(typeof(ISessionService)) as ISessionService;

                if (this._sessionService == null)
                {
                    throw new ArgumentException("RSAuthorizationFilterAttribute.ISessionService");
                }

                var value = this._sessionService.GetById(sessionId);

                if (value != null)
                {
                    ContextOperator.Set(ContextKeys.SESSION_ID, value);
                    return(await continuation());
                }
            }


            return(actionContext.Request.CreateResponse(System.Net.HttpStatusCode.Unauthorized, new ResponseMessage <object>(false, "Unauthorized", null)));
        }
        public ActionResult CategoryWiseImages(string strid)
        {
            int id = Convert.ToInt32(EncryptionDecryption.DecryptString(strid));

            if (id <= 0)
            {
                return(View("Registration"));
            }

            if (CheckSessionAndCookies())
            {
                ViewBag.BannerImage = getRandomBanner();
                int CategoryID = id;
                var Images     = db.tblPortfolioGalleries.Where(PG => PG.tblPortfolio.PortfolioID == _PortfolioID).Where(PG => PG.tblPortfolioGalleryCategory.PortfolioGalleryCategoryID == CategoryID);
                return(View(Images.ToList()));
            }
            else
            {
                return(View("Registration"));
            }
        }