public ActionResult Create(Genre genre) { if (ModelState.IsValid) { _genreService.Add(genre); return PartialView("Thanks"); } return PartialView("_Create", genre); }
public ActionResult Create(GenreEditModel model) { if (ModelState.IsValid) return RedirectToAction("Index"); var genre = new Genre { Name = model.Name, Description = model.Description }; _genreService.Add(genre); return View(model); }
public ActionResult Edit(Genre genre) { if (ModelState.IsValid) { //db.Entry(genre).State = EntityState.Modified; //db.SaveChanges(); _genreService.Update(genre); return PartialView("Thanks"); } return PartialView("_Create", genre); }
public void Add(Genre genre) { _genreRepository.Add(genre); _genreRepository.Save(); }