public ActionResult Create([Bind(Include = "Id,Name")] Genre genre)
        {
            if (ModelState.IsValid)
            {
                genreRepository.CreateGenre(genre);
                return(RedirectToAction("Index"));
            }

            return(View(genre));
        }
示例#2
0
        private async Task Create()
        {
            try
            {
                await GenreRepository.CreateGenre(genre);

                NavMan.NavigateTo("genres");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Exception: {ex.Message}");
            }
        }
示例#3
0
 public ActionResult <Genre> CreateGenre(Genre genre)
 {
     genreRepository.CreateGenre(genre);
     return(CreatedAtAction("GetGenre", new { id = genre.Id }, genre));
 }