Exemple #1
0
        ///<summary>
        ///Returns view of executor profile which contains: recalls, indents with responces, personal data.
        ///Uses _PrivateOfficeExecutorLayout
        ///</summary>
        public ActionResult PrivateOffice()
        {
            var clientId = Session["Id"];

            if (clientId == null)
            {
                return(RedirectToAction("Registration", "Executor"));
            }

            int         executorId  = Convert.ToInt32(clientId);
            ExecutorDTO executorDTO = null;

            string cacheKey = "show-executor-" + executorId.ToString();

            executorDTO = HttpContext.Cache[cacheKey] as ExecutorDTO;

            if (executorDTO == null)
            {
                try
                {
                    executorDTO = _executorService.GetExecutorProfile(executorId);
                }
                catch (ValidationException e)
                {
                    return(RedirectToAction("Registration", "Executor"));
                }

                HttpContext.Cache.Insert(cacheKey, executorDTO, null, DateTime.Now.AddSeconds(120), TimeSpan.Zero);
            }

            UserProfileViewModel userProfileView = _mapper.Map <UserProfileViewModel>(executorDTO);

            return(View(userProfileView));
        }