public IActionResult Create(Genre genre) { if (ModelState.IsValid) { _genreRepo.Create(genre); _genreRepo.Save(); return(RedirectToAction(nameof(Index))); } return(View(genre)); }
public IActionResult PutGenreEntity(int id, GenreCreateDto genreEntity) { if (id != genreEntity.GenreId) { return(BadRequest()); } _repository.Update(id, _mapper.Map <GenreEntity>(genreEntity)); if (!_repository.Save()) { throw new Exception("Failed on save"); } return(NoContent()); }