示例#1
0
        public ActionResult EditSNovelty(SNovelty snovelty)
        {
            if (ModelState.IsValid)
            {
                SNovelty SNovelty = null;

                if (snovelty.Id == 0)
                {
                    SNovelty = snovelty;
                    context.AddSNovelty(SNovelty);
                }
                else
                {
                    SNovelty = context.GetSNoveltyById(snovelty.Id);
                    SNovelty.Name = snovelty.Name;
                    SNovelty.Type = snovelty.Type;
                    SNovelty.htmlcode = snovelty.htmlcode;
                }

                context.SaveChanges();
            }
            return RedirectToAction("SNoveltysEditPage");
        }
示例#2
0
 public void RemoveSNovelty(SNovelty snovelty)
 {
     SNovelties.Remove(snovelty);
     SaveChanges();
 }
示例#3
0
 public void AddSNovelty(SNovelty snovelty)
 {
     SNovelties.Add(snovelty);
     SaveChanges();
 }