public ActionResult DeleteVersion(string versionId) { int _vid = Convert.ToInt32(versionId); Signal signal = _signalsRepository.GetSignalVersionByVersionId(_vid); if (signal == null) { return(Content("<h1>" + "No Version with this ID can be found " + "</h1>")); } string sigId = signal.SignalID; Signal mostRecentVersion; try { _signalsRepository.SetVersionToDeleted(_vid); } catch (Exception ex) { return(Content("<h1>" + ex.Message + "</h1>")); } finally { mostRecentVersion = _signalsRepository.GetLatestVersionOfSignalBySignalID(sigId); AddSelectListsToViewBag(mostRecentVersion); } return(PartialView("Edit", mostRecentVersion)); }