Exemplo n.º 1
0
        /// <summary>
        /// Show profile user
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        public ActionResult ShowProfile(string userName, int page = 1)
        {
            IEnumerable <PhotoViewModel> photos = null;

            try
            {
                photos = _photoService.AllUserPhotos(userName).Select(t => t.ToMVCPhoto());
            }
            catch
            {
                return(RedirectToAction("Error", "Error"));
            }
            int pageSize = 12;

            var ivm     = new IndexViewModel <PhotoViewModel>(page, pageSize, photos);
            var profile = new ProfileViewModel
            {
                UserInformation = _informationServiceService.GetByUserId(_userService.GetUserByName(userName).Id).ToMVCInformationUsers(),
                AllUserPhotos   = ivm,
                UserName        = userName
            };

            return(View(profile));
        }