public IActionResult GetPartFromTypeAndRole( [FromRoute] string database, [FromRoute] string id, [FromRoute] string type, [FromRoute] string role) { ICadmusRepository repository = _repositoryProvider.CreateRepository(database); IPart part = repository.GetItemParts(new[] { id }, type == "any" ? null : type, role == "default" ? null : role) .FirstOrDefault(); if (part == null) { return(NotFound()); } string json = repository.GetPartContent(part.Id); if (json == null) { return(new NotFoundResult()); } json = AdjustPartJson(json); object result = JsonConvert.DeserializeObject(json); return(Ok(result)); }
public IActionResult GetBaseText( [FromRoute] string database, [FromRoute] string itemId) { ICadmusRepository repository = _repositoryProvider.CreateRepository(database); IHasText partWithText = repository.GetItemParts( new[] { itemId }, null, PartBase.BASE_TEXT_ROLE_ID) .FirstOrDefault() as IHasText; return(Ok(new { Part = partWithText, Text = partWithText?.GetText() })); }