diff --git a/Controllers/XWebinarServiceControllerBase.cs b/Controllers/XWebinarServiceControllerBase.cs
index 543e31e..2f07c53 100644
--- a/Controllers/XWebinarServiceControllerBase.cs
+++ b/Controllers/XWebinarServiceControllerBase.cs
@@ -859,6 +859,74 @@ namespace xWebinarService.Controllers
return result;
}
}
+
+ ///
+ /// Stream Specified File of Specified Webinar ...
+ ///
+ ///
+ ///
+ ///
+ [HttpGet("{id}/Files/{fileId}/Stream")]
+ public virtual async Task StreamFile(
+ [FromRoute] Guid id,
+ [FromRoute] Guid fileId
+ )
+ {
+ //
+ // Do ...
+ try
+ {
+ //
+ var result = await WebinarProvider
+ .StreamFile(
+ id: id,
+ fileId: fileId
+ );
+
+ //
+ return result;
+ }
+ catch (Exception ex)
+ {
+ //
+ var result = GetExceptionActionResult(ex);
+ return result;
+ }
+ }
+
+ ///
+ /// Download Specified File of Specified Webinar ...
+ ///
+ ///
+ ///
+ ///
+ [HttpGet("{id}/Files/{fileId}/Download")]
+ public virtual async Task DownloadFile(
+ [FromRoute] Guid id,
+ [FromRoute] Guid fileId
+ )
+ {
+ //
+ // Do ...
+ try
+ {
+ //
+ var result = await WebinarProvider
+ .DownloadFile(
+ id: id,
+ fileId: fileId
+ );
+
+ //
+ return result;
+ }
+ catch (Exception ex)
+ {
+ //
+ var result = GetExceptionActionResult(ex);
+ return result;
+ }
+ }
#endregion
//
@@ -870,7 +938,7 @@ namespace xWebinarService.Controllers
///
///
[HttpPost("{id}/Tags")]
- public virtual async Task TagsAttach(
+ public virtual async Task AttachTags(
[FromRoute] Guid id,
[FromQuery] string tags
)
@@ -887,7 +955,7 @@ namespace xWebinarService.Controllers
//
var tagsList = tags.ParseListString();
await WebinarProvider
- .TagsAttach(
+ .AttachTags(
id: id,
tags: tagsList,
userInfo: userInfo,
@@ -912,7 +980,7 @@ namespace xWebinarService.Controllers
///
///
[HttpDelete("{id}/Tags")]
- public virtual async Task TagsDetach(
+ public virtual async Task DetachTags(
[FromRoute] Guid id,
[FromQuery] string tags
)
@@ -929,7 +997,7 @@ namespace xWebinarService.Controllers
//
var tagsList = tags.ParseListString();
await WebinarProvider
- .TagsDetach(
+ .DetachTags(
id: id,
tags: tagsList,
userInfo: userInfo,
@@ -946,6 +1014,42 @@ namespace xWebinarService.Controllers
return result;
}
}
+
+ ///
+ /// Retrieve Specified Webinars Tags ...
+ ///
+ ///
+ ///
+ [HttpGet("{id}/Tags")]
+ public virtual async Task>> GetTags(
+ [FromRoute] Guid id
+ )
+ {
+ //
+ // Do ...
+ try
+ {
+ //
+ // Retrieve User Info ...
+ var userInfo = await GetUserInfo();
+
+ //
+ await WebinarProvider
+ .GetTags(
+ id: id,
+ userInfo: userInfo
+ );
+
+ //
+ return Ok();
+ }
+ catch (Exception ex)
+ {
+ //
+ var result = GetExceptionActionResult(ex);
+ return result;
+ }
+ }
#endregion
}
}
\ No newline at end of file
diff --git a/Interfaces/IXWebinarProvider.cs b/Interfaces/IXWebinarProvider.cs
index 5755ae9..796d1ce 100644
--- a/Interfaces/IXWebinarProvider.cs
+++ b/Interfaces/IXWebinarProvider.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using xDataService.Configuration;
using xIdentityModels.Models;
@@ -115,7 +116,7 @@ namespace xWebinarService.Interfaces
///
Task> ConditionalQueryWebinars(
Expression> whereClause,
- XQuery query
+ XQuery query
);
///
@@ -266,6 +267,26 @@ namespace xWebinarService.Interfaces
///
///
Task> GetFiles(Guid id);
+
+ ///
+ /// Stream Specified File ...
+ ///
+ ///
+ ///
+ Task StreamFile(
+ Guid id,
+ Guid fileId
+ );
+
+ ///
+ /// Stream Specified File ...
+ ///
+ ///
+ ///
+ Task DownloadFile(
+ Guid id,
+ Guid fileId
+ );
#endregion
//
@@ -279,7 +300,7 @@ namespace xWebinarService.Interfaces
///
///
///
- Task TagAttach(
+ Task AttachTag(
string tag,
Guid id,
XUserClaimsInfoDto userInfo = null,
@@ -296,7 +317,7 @@ namespace xWebinarService.Interfaces
///
///
///
- Task TagDetach(
+ Task DetachTag(
string tag,
Guid id,
XUserClaimsInfoDto userInfo = null,
@@ -313,7 +334,7 @@ namespace xWebinarService.Interfaces
///
///
///
- Task TagsAttach(
+ Task AttachTags(
IEnumerable tags,
Guid id,
XUserClaimsInfoDto userInfo = null,
@@ -330,7 +351,7 @@ namespace xWebinarService.Interfaces
///
///
///
- Task TagsDetach(
+ Task DetachTags(
IEnumerable tags,
Guid id,
XUserClaimsInfoDto userInfo = null,
@@ -345,12 +366,23 @@ namespace xWebinarService.Interfaces
///
///
///
- Task TagsDetach(
+ Task DetachTags(
Guid id,
XUserClaimsInfoDto userInfo = null,
string connectionId = null,
bool forceDetachFromFiles = true
);
+
+ ///
+ /// Retrieve Specified Webinar's Tags ...
+ ///
+ ///
+ ///
+ ///
+ Task> GetTags(
+ Guid id,
+ XUserClaimsInfoDto userInfo = null
+ );
#endregion
}
}
\ No newline at end of file
diff --git a/Interfaces/IXWebinarServiceControllerActions.cs b/Interfaces/IXWebinarServiceControllerActions.cs
index 928c107..3979671 100644
--- a/Interfaces/IXWebinarServiceControllerActions.cs
+++ b/Interfaces/IXWebinarServiceControllerActions.cs
@@ -191,6 +191,28 @@ namespace xWebinarService.Interfaces
Task>> GetFiles(
[FromRoute] Guid id
);
+
+ ///
+ /// Stream Specified File of Specified Webinar ...
+ ///
+ ///
+ ///
+ ///
+ Task StreamFile(
+ [FromRoute] Guid id,
+ [FromRoute] Guid fileId
+ );
+
+ ///
+ /// Download Specified File of Specified Webinar ...
+ ///
+ ///
+ ///
+ ///
+ Task DownloadFile(
+ [FromRoute] Guid id,
+ [FromRoute] Guid fileId
+ );
#endregion
//
@@ -201,7 +223,7 @@ namespace xWebinarService.Interfaces
///
///
///
- Task TagsAttach(
+ Task AttachTags(
[FromRoute] Guid id,
[FromQuery] string tags
);
@@ -212,10 +234,19 @@ namespace xWebinarService.Interfaces
///
///
///
- Task TagsDetach(
+ Task DetachTags(
[FromRoute] Guid id,
[FromQuery] string tags
);
+
+ ///
+ /// Retrieve Specified Webinars Tags ...
+ ///
+ ///
+ ///
+ Task>> GetTags(
+ [FromRoute] Guid id
+ );
#endregion
}
}
\ No newline at end of file
diff --git a/Providers/XWebinarProvider.cs b/Providers/XWebinarProvider.cs
index 5606920..f329073 100644
--- a/Providers/XWebinarProvider.cs
+++ b/Providers/XWebinarProvider.cs
@@ -4,6 +4,7 @@ using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using xCommons.Extensions;
using xDataService.Configuration;
@@ -331,7 +332,7 @@ namespace xWebinarService.Providers
try
{
//
- await TagsAttach(
+ await AttachTags(
tags: tags,
id: entity.Id,
userInfo: userInfo,
@@ -961,7 +962,7 @@ namespace xWebinarService.Providers
// Detach Tags ...
try
{
- await TagsDetach(entity.Id, userInfo);
+ await DetachTags(entity.Id, userInfo);
}
catch { }
@@ -1519,6 +1520,82 @@ namespace xWebinarService.Providers
//
return result;
}
+
+ ///
+ /// Stream Specified File of Specified Webinar ...
+ ///
+ ///
+ ///
+ ///
+ public async Task StreamFile(
+ Guid id,
+ Guid fileId
+ )
+ {
+ //
+ // Validate ...
+ var isValid = !id.IsNull() &&
+ !fileId.IsNull() &&
+ !id.IsDefaultGuid() &&
+ !fileId.IsDefaultGuid();
+ if (!isValid)
+ {
+ XException.InvalidArgs.Throw();
+ }
+
+ //
+ // Check Specified File is Refrenced to Specified Webinar ...
+ var files = await WebinarFileProvider.GetAllFor(id);
+ isValid = !files.IsNull() &&
+ files.HasChild() &&
+ files.Any(f => f.Id == fileId);
+ if (!isValid)
+ {
+ XException.NotFound.Throw();
+ }
+
+ //
+ var result = await WebinarFileProvider.Stream(fileId);
+ return result;
+ }
+
+ ///
+ /// Download Specified File of Specified Webinar ...
+ ///
+ ///
+ ///
+ ///
+ public async Task DownloadFile(
+ Guid id,
+ Guid fileId
+ )
+ {
+ //
+ // Validate ...
+ var isValid = !id.IsNull() &&
+ !fileId.IsNull() &&
+ !id.IsDefaultGuid() &&
+ !fileId.IsDefaultGuid();
+ if (!isValid)
+ {
+ XException.InvalidArgs.Throw();
+ }
+
+ //
+ // Check Specified File is Refrenced to Specified Webinar ...
+ var files = await WebinarFileProvider.GetAllFor(id);
+ isValid = !files.IsNull() &&
+ files.HasChild() &&
+ files.Any(f => f.Id == fileId);
+ if (!isValid)
+ {
+ XException.NotFound.Throw();
+ }
+
+ //
+ var result = await WebinarFileProvider.Download(fileId);
+ return result;
+ }
#endregion
//
@@ -1532,7 +1609,7 @@ namespace xWebinarService.Providers
///
///
///
- public async Task TagAttach(
+ public async Task AttachTag(
string tag,
Guid id,
XUserClaimsInfoDto userInfo = null,
@@ -1578,11 +1655,11 @@ namespace xWebinarService.Providers
foreach (var media in medias)
{
//
- await WebinarFileProvider.Provider.TagAttach(
- tag,
- media.Id,
- userInfo,
- connectionId
+ await WebinarFileProvider.Provider.AttachTag(
+ id: media.Id,
+ tag: tag,
+ userInfo: userInfo,
+ connectionId: connectionId
);
}
}
@@ -1601,7 +1678,7 @@ namespace xWebinarService.Providers
///
///
///
- public async Task TagDetach(
+ public async Task DetachTag(
string tag,
Guid id,
XUserClaimsInfoDto userInfo = null,
@@ -1645,11 +1722,11 @@ namespace xWebinarService.Providers
foreach (var media in medias)
{
//
- await WebinarFileProvider.Provider.TagDetach(
- tag,
- media.Id,
- userInfo,
- connectionId
+ await WebinarFileProvider.Provider.DetachTag(
+ id: media.Id,
+ tag: tag,
+ userInfo: userInfo,
+ connectionId: connectionId
);
}
}
@@ -1668,7 +1745,7 @@ namespace xWebinarService.Providers
///
///
///
- public async Task TagsAttach(
+ public async Task AttachTags(
IEnumerable tags,
Guid id,
XUserClaimsInfoDto userInfo = null,
@@ -1702,7 +1779,7 @@ namespace xWebinarService.Providers
foreach (var tag in tags)
{
//
- await TagAttach(
+ await AttachTag(
tag,
id,
userInfo,
@@ -1724,7 +1801,7 @@ namespace xWebinarService.Providers
///
///
///
- public async Task TagsDetach(
+ public async Task DetachTags(
IEnumerable tags,
Guid id,
XUserClaimsInfoDto userInfo = null,
@@ -1758,7 +1835,7 @@ namespace xWebinarService.Providers
foreach (var tag in tags)
{
//
- await TagDetach(
+ await DetachTag(
tag,
id,
userInfo,
@@ -1778,7 +1855,7 @@ namespace xWebinarService.Providers
///
///
///
- public async Task TagsDetach(
+ public async Task DetachTags(
Guid id,
XUserClaimsInfoDto userInfo = null,
string connectionId = null,
@@ -1818,7 +1895,11 @@ namespace xWebinarService.Providers
foreach (var media in medias)
{
//
- await WebinarFileProvider.Provider.TagsDetach(media.Id, userInfo, connectionId);
+ await WebinarFileProvider.Provider.DetachTags(
+ id: media.Id,
+ userInfo: userInfo,
+ connectionId: connectionId
+ );
}
}
}
@@ -1826,6 +1907,57 @@ namespace xWebinarService.Providers
catch { }
}
}
+
+ ///
+ /// Retrieve Specified Webinar's Tags ...
+ ///
+ ///
+ ///
+ ///
+ public async Task> GetTags(
+ Guid id,
+ XUserClaimsInfoDto userInfo = null
+ )
+ {
+ //
+ // Validate Args ...
+ var isValid = !id.IsNull() &&
+ !id.IsDefaultGuid() &&
+ !userInfo.IsNullOrDefault();
+ if (!isValid)
+ {
+ XException.InvalidArgs.Throw();
+ }
+
+ //
+ // Checking Permissions ...
+
+ //
+ // Checking Exists ...
+ isValid = await WebinarRepository.IsExistsAsync(id);
+ if (!isValid)
+ {
+ XException.NotFound.Throw();
+ }
+
+ //
+ // Reading Tags Dto List ...
+ var tagsDtos = await WebinarTagProvider.GetTags(id);
+
+ //
+ var result = new List();
+ isValid = !tagsDtos.IsNull() && tagsDtos.HasChild();
+ if (isValid)
+ {
+ //
+ result = tagsDtos
+ .Select(td => td.Tag)
+ .ToList();
+ }
+
+ //
+ return result;
+ }
#endregion
//