public ActionResult Create(GenreModel genre) { try { if (ModelState.IsValid && service.GetAllGenres().All(e => e.Name != genre.Name)) { service.AddGenre(genre.ToServiceGenre()); if (Request.IsAjaxRequest()) { return(PartialView("_GenreTreeView", Genre.GetGenreIndexModel())); } return(RedirectToAction("Index")); } if (Request.IsAjaxRequest()) { return(PartialView("_GenreTreeView", Genre.GetGenreIndexModel())); } return(RedirectToAction("Index")); } catch (Exception ex) { logger.Error(ex); return(View("Error")); } }