public ActionResult Create(Flavor flavor, int TreatId)
 {
     _db.Flavor.Add(flavor);
     if (TreatId != 0)
     {
         _db.TreatFlavor.Add(new TreatFlavor()
         {
             TreatId = TreatId, FlavorId = flavor.FlavorId
         });
     }
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Exemple #2
0
 public ActionResult Create(Treat treat, int FlavorId)
 {
     _db.Treat.Add(treat);
     if (FlavorId != 0)
     {
         _db.TreatFlavor.Add(new TreatFlavor()
         {
             FlavorId = FlavorId, TreatId = treat.TreatId
         });
     }
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }