Exemplo n.º 1
0
        public ActionResult Index()
        {
            var gs             = _unitOfWork.GlobalSettings.GetGlobalValues();
            var websiteContent = _unitOfWork.WebsiteContent.GetWebsiteContent();

            var model = new ContactEditorViewModel()
            {
                WebsiteEmailAddress = gs.EmailAddress,
                FacebookLink        = gs.FacebookLink,
                GooglePlusLink      = gs.GooglePlusLink,
                InstagramLink       = gs.InstagramLink,
                LinkedinLink        = gs.LinkedinLink,
                PinterestLink       = gs.PinterestLink,
                TwitterLink         = gs.TwitterLink,
                YoutubeLink         = gs.YoutubeLink,
                ContactFirstSectionFirstParagraph = websiteContent.ContactFirstSectionFirstParagraph,
                ContactFirstSectionSignature      = websiteContent.ContactFirstSectionSignature,
                ContactFirstSectionTitle          = websiteContent.ContactFirstSectionTitle,
                ContactMainImageName = websiteContent.ContactMainImageName,
                ContactMainImagePath = websiteContent.ContactMainImagePath,
                ContactSubtitle      = websiteContent.ContactSubtitle,
                ContactTitle         = websiteContent.ContactTitle
            };

            ViewBag.TopImage    = websiteContent.ContactMainImagePath + "/" + websiteContent.ContactMainImageName;
            ViewBag.Headline    = websiteContent.ContactTitle;
            ViewBag.SubHeadline = websiteContent.ContactSubtitle;

            return(View(model));
        }
Exemplo n.º 2
0
        public void SaveCommandEmitsNewModelRevision(ContactEditorViewModel sut)
        {
            Contact next = null;
            Stream<Contact, int>
                .Connect(sut.Model.Id)
                .Subscribe(x => next = x);

            sut.SaveCommand.Execute(null);

            next.Should().NotBeNull();
            next.Name.Should().Be(sut.EditName);
            next.Email.Should().Be(sut.EditEmail);
        }
Exemplo n.º 3
0
        public ActionResult SaveContactContent(ContactEditorViewModel model)
        {
            var websiteContent = _unitOfWork.WebsiteContent.GetWebsiteContent();
            var HomepagePath   = "/DynamicContent/ContactContent";

            websiteContent.ContactTitle    = model.ContactTitle;
            websiteContent.ContactSubtitle = model.ContactSubtitle;
            websiteContent.ContactFirstSectionFirstParagraph = model.ContactFirstSectionFirstParagraph;
            websiteContent.ContactFirstSectionSignature      = model.ContactFirstSectionSignature;
            websiteContent.ContactFirstSectionTitle          = model.ContactFirstSectionTitle;

            if (model.ContactMainImageFile != null)
            {
                websiteContent.ContactMainImageName = model.ContactMainImageFile.FileName;
                websiteContent.ContactMainImagePath = HomepagePath;
                model.ContactMainImageFile.SaveAs(Path.Combine(Server.MapPath(HomepagePath), model.ContactMainImageFile.FileName));
            }

            _unitOfWork.Complete();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
        public ActionResult SubmitForm(ContactEditorViewModel model)
        {
            var lead = new Lead()
            {
                BusinessName = model.BusinessName,
                EmailAddress = model.EmailAddress,
                FirstName    = model.FirstName,
                LastName     = model.LastName,
                LeadSource   = "Contact form",
                Location     = model.Location,
                Note         = model.Note,
                PhoneNumber  = model.PhoneNumber,
                Website      = model.Website,
                Date         = DateTime.Now
            };

            _unitOfWork.Lead.AddNewLead(lead);
            _unitOfWork.Complete();

            string imgHtml = "<img src='/Content/img/thank-you.jpg' alt='Thank you!' class='w-100 thank-you-img' />";

            return(Content(imgHtml, "text/html"));
        }