Пример #1
0
        public ActionResult EditAssociationpages()
        {
            Association association = reposetory.GetAssociationWithPages(CurrentProfile.AssociationID);

            AssociationPagesModel viewModel = new AssociationPagesModel(association);

            return View(viewModel);
        }
Пример #2
0
        public ActionResult EditAssociationpages(AssociationPagesModel result)
        {
            Association association = reposetory.GetAssociationWithPages(CurrentProfile.AssociationID);
            if (ModelState.ContainsKey("PageAbout.Title")) ModelState["PageAbout.Title"].Errors.Clear();
            if (ModelState.ContainsKey("PagePress.Title")) ModelState["PagePress.Title"].Errors.Clear();
            if (ModelState.ContainsKey("PageLink.Title")) ModelState["PageLink.Title"].Errors.Clear();
            if (ModelState.ContainsKey("PageSponsor.Title")) ModelState["PageSponsor.Title"].Errors.Clear();
 


            if (ModelState.IsValid)
            {
                association.PageAbout.Body = result.PageAbout.Body;
                if (string.IsNullOrWhiteSpace(association.PageAbout.Title)) association.PageAbout.Title = DefaultForening.PageContentAboutTitle;
                association.PageLink.Body = result.PageLink.Body;
                if (string.IsNullOrWhiteSpace(association.PageLink.Title)) association.PageLink.Title = DefaultForening.PageContentLinkTitle;
                association.PagePress.Body = result.PagePress.Body;
                if (string.IsNullOrWhiteSpace(association.PagePress.Title)) association.PagePress.Title = DefaultForening.PageContentPressTitle;
                association.PageSponsor.Body = result.PageSponsor.Body;
                if (string.IsNullOrWhiteSpace(association.PageSponsor.Title)) association.PageSponsor.Title = DefaultForening.PageContentSponsorTitle;
                association.Sponsors = result.Sponsors;

                if (reposetory.SaveAssociation(association))
                {
                    ViewBag.FormSucces = true;
                    ModelState.Clear();
                }
                
                AssociationPagesModel viewModel = new AssociationPagesModel(association);

                return View(viewModel);
            }


            return View(result);
        }