Exemple #1
0
        public ActionResult Create(Genre genre)
        {
            if (ModelState.IsValid)
            {

                genre.Date_Creation = DateTime.Now;

                context.Genres.Add(genre);
                context.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(genre);
        }
Exemple #2
0
 public ActionResult Edit(Genre genre)
 {
     if (ModelState.IsValid)
     {
         context.Entry(genre).State = EntityState.Modified;
         context.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(genre);
 }