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");
        }
Exemple #2
0
 public void RemoveSNovelty(SNovelty snovelty)
 {
     SNovelties.Remove(snovelty);
     SaveChanges();
 }
Exemple #3
0
 public void AddSNovelty(SNovelty snovelty)
 {
     SNovelties.Add(snovelty);
     SaveChanges();
 }