//AJAX CALL public ActionResult GetPlaysForSource(string id) { theLogger.Info(String.Format("method GetPlaysForSource, parameter id {0}", id)); if (String.IsNullOrWhiteSpace(id)) { theLogger.Error("Reason: id is null or white space"); return(PartialView("playList", new List <Play>())); } FoireMusesConnection connection = GetConnection(); SearchResult <Play> searchResultPlay = null; try { searchResultPlay = connection.GetPlaysFromSource(id, 0, 0, new Result <SearchResult <Play> >()).Wait(); } catch (Exception e) { theLogger.Error("Stacktrace:\n" + e.StackTrace); return(PartialView("playList", new List <Play>())); } if (searchResultPlay == null) { theLogger.Error("Reason: searchResultPlay result is null"); return(PartialView("playList", new List <Play>())); } return(PartialView("playList", searchResultPlay.Rows)); }
public ActionResult Edit(string scoreId) { theLogger.Info(String.Format("GET method Edit, parameter scoreId {0}", scoreId)); FoireMusesConnection connection = GetConnection(); Score score = null; SearchResult <SourceSearchItem> sourceList = null; try { if (!String.IsNullOrWhiteSpace(scoreId)) //get the score matching the id { score = connection.GetScore(scoreId, new Result <Score>()).Wait(); if (score == null) { return(RedirectToAction("Missing", "Error", null)); } if (score.TextualSource != null && score.TextualSource.PieceId != null) { SearchResult <Play> searchResultPlay = null; searchResultPlay = connection.GetPlaysFromSource(score.TextualSource.SourceId, 0, 0, new Result <SearchResult <Play> >()).Wait(); if (searchResultPlay == null) { return(RedirectToAction("Problem", "Error", null)); } ViewBag.Pieces = searchResultPlay.Rows; } if (score.MasterId != null) { Score maitre = connection.GetScore(score.MasterId, new Result <Score>()).Wait(); if (maitre == null) { score.MasterId = null; } else { ViewBag.MasterIdTitle = maitre.Title; } } ViewBag.HeadTitle = "Edition"; } else { score = new Score(); ViewBag.HeadTitle = "Création"; } sourceList = connection.GetSources(0, 0, new Result <SearchResult <SourceSearchItem> >()).Wait(); } catch (Exception e) { return(RedirectToAction("Problem", "Error", null)); } if (score == null || sourceList == null) { return(RedirectToAction("Missing", "Error", null)); } ViewBag.Sources = sourceList.Rows.OrderBy(x => x.Name); return(View("Edit", score)); }