Exemple #1
0
        public FeedbackViewModel GetBasicViewModel(FeedbackFormIdentification formIdentification, string staticTextName,
                                                   bool isAuthenticated, string scope, ClaimsPrincipal user)
        {
            var pageStaticText = m_staticTextManager.GetRenderedHtmlText(staticTextName, scope);

            if (isAuthenticated)
            {
                var viewModel = new FeedbackViewModel
                {
                    Name               = $"{user.GetFirstName()} {user.GetLastName()}",
                    Email              = user.GetEmail(),
                    PageStaticText     = pageStaticText,
                    FormIdentification = formIdentification
                };

                return(viewModel);
            }
            else
            {
                var viewModel = new FeedbackViewModel
                {
                    PageStaticText     = pageStaticText,
                    FormIdentification = formIdentification
                };

                return(viewModel);
            }
        }
Exemple #2
0
        public FeedbackViewModel GetBasicViewModel(FeedbackFormIdentification formIdentification, string staticTextName, ItJakubServiceEncryptedClient client, string username = null)
        {
            var pageStaticText = m_staticTextManager.GetRenderedHtmlText(staticTextName);

            if (string.IsNullOrWhiteSpace(username))
            {
                var viewModel = new FeedbackViewModel
                {
                    PageStaticText     = pageStaticText,
                    FormIdentification = formIdentification
                };

                return(viewModel);
            }

            using (client)
            {
                var user      = client.FindUserByUserName(username);
                var viewModel = new FeedbackViewModel
                {
                    Name               = string.Format("{0} {1}", user.FirstName, user.LastName),
                    Email              = user.Email,
                    PageStaticText     = pageStaticText,
                    FormIdentification = formIdentification
                };

                return(viewModel);
            }
        }