//pouze pripraveno na pagination, cele to vsak chci zkusit prepsat do dotVVM, ale neni moc casu :)
        public async Task <ActionResult> Index(string nickName = "", int postPage = 1, int commentPage = 1)
        {
            //delete this after Identity.UserId is set
            var user = await BasicUserFacade.GetUserByNickNameAsync(nickName);

            var postFilter = new PostFilterDto()
            {
                PageSize = Posts, RequestedPageNumber = postPage
            };

            Session[PostFilterSessionKey] = postFilter;
            postFilter.UserId             = user.Id;

            var commentFilter = Session[CommentFilterSessionKey] as CommentFilterDto ?? new CommentFilterDto()
            {
                PageSize = Comments
            };

            commentFilter.RequestedPageNumber = commentPage;

            var userDto = await UserProfileFacade.GetUserProfile(postFilter, commentFilter);

            var authUser = await BasicUserFacade.GetUserByNickNameAsync(User.Identity.Name);


            return(View("UserProfile", new UserProfileModel
            {
                UserProfileUser = userDto,
                AuthenticatedUser = authUser,
                PostFilter = postFilter,
                CommentFilter = commentFilter
            }));
        }
        public async Task <ActionResult> AddPost(UserProfileModel model)
        {
            try
            {
                await UserProfileFacade.AddPost(new UserProfilePostDto()
                {
                    PostedAt      = DateTime.Now.ToUniversalTime(),
                    StayAnonymous = model.PostIsVisibleOnlyToFriends,
                    UserId        = model.UserProfileUser.Id,
                    Text          = model.NewPostText
                });

                return(RedirectToAction("Index", new { nickName = model.UserProfileUser.NickName }));
            }
            catch
            {
                return(RedirectToAction("Index", new { nickName = model.UserProfileUser.NickName }));
            }
        }
Example #3
0
 public HomeController()
 {
     UserProfileFacade profileFacade = new UserProfileFacade(ApplicationName.Spontaneous);
     m_serviceLayer = new ServiceLayerImpl(profileFacade);
     log.Debug("[HomeController] c'tor");
 }
 public UserProfileController(IOptions <AppSettings> _appSettings, IAuthenticateHelper _authHelper)
 {
     appSettings = _appSettings.Value;
     facade      = new UserProfileFacade(appSettings.VotingPlatformConnectionString, appSettings.KunciRahasiaAES);
     authHelper  = _authHelper;
 }
Example #5
0
 public UserProfile()
 {
     facade  = new UserProfileFacade(connectionString, kunciRahasiaku);
     request = new UserProfileRequest();
 }
Example #6
0
 public HomeController()
 {
     UserProfileFacade profileFacade = new UserProfileFacade();
     m_serviceLayer = new ServiceLayerImpl(profileFacade);
     log.Debug("[HomeController] c'tor");
 }