public ActionResult Create([Bind(Include = "Id,Name")] Genre genre) { if (ModelState.IsValid) { genreRepository.CreateGenre(genre); return(RedirectToAction("Index")); } return(View(genre)); }
private async Task Create() { try { await GenreRepository.CreateGenre(genre); NavMan.NavigateTo("genres"); } catch (Exception ex) { Console.WriteLine($"Exception: {ex.Message}"); } }
public ActionResult <Genre> CreateGenre(Genre genre) { genreRepository.CreateGenre(genre); return(CreatedAtAction("GetGenre", new { id = genre.Id }, genre)); }