Esempio n. 1
0
 public ActionResult Create(Sport sport)
 {
     if (ModelState.IsValid)
     {
         _db.Sport.Add(sport);
         _db.SaveChanges();
         Success("Your information was saved!");
         return RedirectToAction("Index");
     }
     Error("there were some errors in your form.");
     return View(sport);
 }
Esempio n. 2
0
        public ActionResult Edit(Sport sport)
        {
            if (ModelState.IsValid)
            {
                _db.Entry(sport).State = EntityState.Modified;
                _db.SaveChanges();
                Success("The model was updated!");

                return RedirectToAction("Index");
            }
            return View("Create", sport);
        }