Example #1
0
        public ActionResult Support(SupportFormViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(ViewSupportImpl(viewModel, string.Empty));
            }
            var supportRequestLog = SupportRequestLogModelExtensions.Create(CurrentFirmaSession);

            viewModel.UpdateModel(supportRequestLog, CurrentFirmaSession);
            HttpRequestStorage.DatabaseEntities.AllSupportRequestLogs.Add(supportRequestLog);
            SupportRequestLogModelExtensions.SendMessage(supportRequestLog, Request.UserHostAddress, Request.UserAgent, viewModel.CurrentPageUrl, supportRequestLog.SupportRequestType, HttpRequestStorage.DatabaseEntities, FirmaWebConfiguration.DefaultSupportPersonID);
            SetMessageForDisplay("Support request sent.");
            if (CurrentFirmaSession.IsAnonymousUser())
            {
                // This is a rare place in the system where an anonymous user writes to the DB.
                // If this becomes more commonplace we can work out a more general solution.
                HttpRequestStorage.DatabaseEntities.SaveChangesWithNoAuditing(CurrentFirmaSession.TenantID);
            }
            else
            {
                // Logged in user, normal audit trail on save
                SitkaDbContext.SaveChanges();
            }

            return(new ModalDialogFormJsonResult());
        }
Example #2
0
        public ActionResult RequestSupport(RequestSupportViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(ViewRequestSupport(viewModel));
            }
            var supportRequestLog = SupportRequestLogModelExtensions.Create(CurrentFirmaSession);

            viewModel.UpdateModel(supportRequestLog, CurrentFirmaSession);
            HttpRequestStorage.DatabaseEntities.AllSupportRequestLogs.Add(supportRequestLog);
            SupportRequestLogModelExtensions.SendMessage(supportRequestLog, Request.UserHostAddress, Request.UserAgent, viewModel.CurrentPageUrl, supportRequestLog.SupportRequestType, HttpRequestStorage.DatabaseEntities, FirmaWebConfiguration.DefaultSupportPersonID);
            SetMessageForDisplay("Message sent. Thank you for contacting us.");
            var returnUrl = viewModel.ReturnUrl ?? SitkaRoute <HomeController> .BuildUrlFromExpression(x => x.Index());

            return(Redirect(returnUrl));
        }