Ejemplo n.º 1
0
        public void Save(StaticContent content)
        {
            var oldRecord = _db.StaticContent.FirstOrDefault(x => x.TypeStaticContent == content.TypeStaticContent);

            if (oldRecord != null)
            {
                oldRecord.Body = content.Body;
                oldRecord.Title = content.Title;

                _db.StaticContent.Attach(oldRecord);
                _db.Entry(oldRecord).State = EntityState.Modified;
                _db.SaveChanges();
                return;
            }

            _db.StaticContent.Add(content);
            _db.SaveChanges();
        }
Ejemplo n.º 2
0
        public ActionResult AddStaticContent(StaticContent staticContent)
        {
            StaticContentRepository.Save(staticContent);

            return View();
        }