示例#1
0
        public ActionResult NewHomePage(HomePageContentInformation content)
        {
            if (ModelState.IsValid)
            {
                using (var iRepo = new ImportRepository())
                {
                    iRepo.UpsertHomePageContent(content);

                    return(RedirectToAction("Index", "Home"));
                }
            }

            return(View());
        }
示例#2
0
        public bool UpsertHomePageContent(HomePageContentInformation content)
        {
            var dbContent = database.HomePageContents.FirstOrDefault();

            if (dbContent != null)
            {
                dbContent.ContentData = content.ContentArea;
            }
            else
            {
                database.HomePageContents.Add(new HomePageContent()
                {
                    ContentData = content.ContentArea
                });
            }

            return(database.SaveChanges() > 0);
        }