/// <summary> /// Gets the item. /// </summary> /// <param name="request">The request.</param> /// <returns>Task{BaseItemDto}.</returns> private BaseItemDto GetItem(GetMusicGenre request) { var dtoOptions = GetDtoOptions(AuthorizationContext, request); var item = GetMusicGenre(request.Name, LibraryManager, dtoOptions); if (!string.IsNullOrWhiteSpace(request.UserId)) { var user = UserManager.GetUserById(request.UserId); return(DtoService.GetBaseItemDto(item, dtoOptions, user)); } return(DtoService.GetBaseItemDto(item, dtoOptions)); }
/// <summary> /// Gets the item. /// </summary> /// <param name="request">The request.</param> /// <returns>Task{BaseItemDto}.</returns> private BaseItemDto GetItem(GetMusicGenre request) { var dtoOptions = GetDtoOptions(AuthorizationContext, request); var item = GetMusicGenre(request.Name, LibraryManager, dtoOptions); if (!request.UserId.Equals(Guid.Empty)) { var user = UserManager.GetUserById(request.UserId); return(DtoService.GetBaseItemDto(item, dtoOptions, user)); } return(DtoService.GetBaseItemDto(item, dtoOptions)); }
/// <summary> /// Gets the item. /// </summary> /// <param name="request">The request.</param> /// <returns>Task{BaseItemDto}.</returns> private BaseItemDto GetItem(GetMusicGenre request) { var item = GetMusicGenre(request.Name, LibraryManager); var dtoOptions = GetDtoOptions(request); if (request.UserId.HasValue) { var user = UserManager.GetUserById(request.UserId.Value); return(DtoService.GetBaseItemDto(item, dtoOptions, user)); } return(DtoService.GetBaseItemDto(item, dtoOptions)); }
/// <summary> /// Gets the item. /// </summary> /// <param name="request">The request.</param> /// <returns>Task{BaseItemDto}.</returns> private BaseItemDto GetItem(GetMusicGenre request) { var item = GetMusicGenre(request.Name, LibraryManager); // Get everything var fields = Enum.GetNames(typeof(ItemFields)).Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true)); if (request.UserId.HasValue) { var user = UserManager.GetUserById(request.UserId.Value); return(DtoService.GetBaseItemDto(item, fields.ToList(), user)); } return(DtoService.GetBaseItemDto(item, fields.ToList())); }
/// <summary> /// Gets the item. /// </summary> /// <param name="request">The request.</param> /// <returns>Task{BaseItemDto}.</returns> private async Task <BaseItemDto> GetItem(GetMusicGenre request) { var item = await GetMusicGenre(request.Name, LibraryManager).ConfigureAwait(false); // Get everything var fields = Enum.GetNames(typeof(ItemFields)).Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true)); var builder = new DtoBuilder(Logger, LibraryManager, UserDataRepository, ItemRepository); if (request.UserId.HasValue) { var user = UserManager.GetUserById(request.UserId.Value); return(await builder.GetBaseItemDto(item, fields.ToList(), user).ConfigureAwait(false)); } return(await builder.GetBaseItemDto(item, fields.ToList()).ConfigureAwait(false)); }
/// <summary> /// Gets the specified request. /// </summary> /// <param name="request">The request.</param> /// <returns>System.Object.</returns> public object Get(GetMusicGenre request) { var result = GetItem(request); return(ToOptimizedResult(result)); }
/// <summary> /// Gets the specified request. /// </summary> /// <param name="request">The request.</param> /// <returns>System.Object.</returns> public object Get(GetMusicGenre request) { var result = GetItem(request); return(ToOptimizedSerializedResultUsingCache(result)); }