last works ...
This commit is contained in:
@@ -13,6 +13,7 @@ using xIdentityService.Interfaces;
|
||||
using xModels.Dtos;
|
||||
using xWebinarService.Interfaces;
|
||||
using xWebinarService.Models.Dtos;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace xWebinarService.Controllers
|
||||
{
|
||||
@@ -52,10 +53,14 @@ namespace xWebinarService.Controllers
|
||||
/// Create Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="tags"></param>
|
||||
/// <param name="files"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("Create")]
|
||||
public virtual async Task<ActionResult<XWebinarDto>> CreateWebinar(
|
||||
[FromBody] XWebinarDto item
|
||||
[FromBody] XWebinarDto item,
|
||||
[FromQuery] string tags = null,
|
||||
[FromForm] IFormFileCollection files = null
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -77,9 +82,12 @@ namespace xWebinarService.Controllers
|
||||
}
|
||||
|
||||
//
|
||||
var tagList = tags.ParseListString<string>();
|
||||
var result = await WebinarProvider
|
||||
.CreateWebinar(
|
||||
item: item,
|
||||
files: files,
|
||||
tags: tagList,
|
||||
connectionId: connectionId
|
||||
);
|
||||
|
||||
@@ -200,33 +208,6 @@ namespace xWebinarService.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve all Exists Webinar Ids ...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("Ids")]
|
||||
public virtual ActionResult<IEnumerable<Guid>> GetWebinarIds()
|
||||
{
|
||||
//
|
||||
// Do ...
|
||||
try
|
||||
{
|
||||
//
|
||||
var result = WebinarProvider
|
||||
.GetWebinarIds();
|
||||
|
||||
//
|
||||
return Ok(result.
|
||||
ToDynamicObject());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query Webinars ...
|
||||
/// </summary>
|
||||
@@ -258,12 +239,12 @@ namespace xWebinarService.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query Webinar Ids ...
|
||||
/// Query Owned Webinars ...
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("QueryIds")]
|
||||
public virtual ActionResult<XQueryResult<Guid>> QueryWebinarIds(
|
||||
[HttpGet("QueryOwned")]
|
||||
public virtual async Task<ActionResult<XQueryResult<XWebinarDto>>> QueryOwnedWebinars(
|
||||
[FromQuery] XQuery query
|
||||
)
|
||||
{
|
||||
@@ -272,8 +253,52 @@ namespace xWebinarService.Controllers
|
||||
try
|
||||
{
|
||||
//
|
||||
var result = WebinarProvider
|
||||
.QueryWebinarIds(query);
|
||||
// Retrieve User Info ...
|
||||
var userInfo = await GetUserInfo();
|
||||
|
||||
//
|
||||
var result = await WebinarProvider
|
||||
.QueryOwnedWebinars(
|
||||
query: query,
|
||||
userInfo: userInfo
|
||||
);
|
||||
|
||||
//
|
||||
return Ok(result.
|
||||
ToDynamicObject());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query Joinable Webinars ...
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("QueryJoinable")]
|
||||
public virtual async Task<ActionResult<XQueryResult<XWebinarDto>>> QueryJoinableWebinars(
|
||||
[FromQuery] XQuery query
|
||||
)
|
||||
{
|
||||
//
|
||||
// Do ...
|
||||
try
|
||||
{
|
||||
//
|
||||
// Retrieve User Info ...
|
||||
var userInfo = await GetUserInfo();
|
||||
|
||||
//
|
||||
var result = await WebinarProvider
|
||||
.QueryJoinableWebinars(
|
||||
query: query,
|
||||
userInfo: userInfo
|
||||
);
|
||||
|
||||
//
|
||||
return Ok(result.
|
||||
@@ -708,5 +733,209 @@ namespace xWebinarService.Controllers
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region File Actions ...
|
||||
/// <summary>
|
||||
/// Upload Specified Files for Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="files"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("{id}/Files")]
|
||||
public virtual async Task<ActionResult<IEnumerable<XFileDto>>> Upload(
|
||||
[FromRoute] Guid id,
|
||||
[FromForm] IFormFileCollection files
|
||||
)
|
||||
{
|
||||
//
|
||||
// Do ...
|
||||
try
|
||||
{
|
||||
//
|
||||
// Retrieve User Info ...
|
||||
var userInfo = await GetUserInfo();
|
||||
var connectionId = GetConnectionId();
|
||||
|
||||
//
|
||||
var result = await WebinarProvider
|
||||
.Upload(
|
||||
id: id,
|
||||
files: files,
|
||||
userInfo: userInfo,
|
||||
connectionId: connectionId
|
||||
);
|
||||
|
||||
//
|
||||
return Ok(result.
|
||||
ToDynamicObject());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove Specified (All) Files of Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{id}/Files")]
|
||||
public virtual async Task<ActionResult<IEnumerable<XFileDto>>> Remove(
|
||||
[FromRoute] Guid id,
|
||||
[FromQuery] string ids = null
|
||||
)
|
||||
{
|
||||
//
|
||||
// Do ...
|
||||
try
|
||||
{
|
||||
//
|
||||
// Retrieve User Info ...
|
||||
var userInfo = await GetUserInfo();
|
||||
var connectionId = GetConnectionId();
|
||||
|
||||
//
|
||||
var result = await WebinarProvider
|
||||
.RemoveFiles(
|
||||
id: id,
|
||||
ids: ids,
|
||||
userInfo: userInfo,
|
||||
connectionId: connectionId
|
||||
);
|
||||
|
||||
//
|
||||
return Ok(result.
|
||||
ToDynamicObject());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve Specified Webinar's Files ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{id}/Files")]
|
||||
public virtual async Task<ActionResult<IEnumerable<XFileDto>>> GetFiles(
|
||||
[FromRoute] Guid id
|
||||
)
|
||||
{
|
||||
//
|
||||
// Do ...
|
||||
try
|
||||
{
|
||||
//
|
||||
var result = await WebinarProvider
|
||||
.GetFiles(id);
|
||||
|
||||
//
|
||||
return Ok(result.
|
||||
ToDynamicObject());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Tags Actions ...
|
||||
/// <summary>
|
||||
/// Attach Specified Tags To Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="tags"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("{id}/Tags")]
|
||||
public virtual async Task<ActionResult> TagsAttach(
|
||||
[FromRoute] Guid id,
|
||||
[FromQuery] string tags
|
||||
)
|
||||
{
|
||||
//
|
||||
// Do ...
|
||||
try
|
||||
{
|
||||
//
|
||||
// Retrieve User Info ...
|
||||
var userInfo = await GetUserInfo();
|
||||
var connectionId = GetConnectionId();
|
||||
|
||||
//
|
||||
var tagsList = tags.ParseListString<string>();
|
||||
await WebinarProvider
|
||||
.TagsAttach(
|
||||
id: id,
|
||||
tags: tagsList,
|
||||
userInfo: userInfo,
|
||||
connectionId: connectionId
|
||||
);
|
||||
|
||||
//
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Detach Specified Tags From Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="tags"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{id}/Tags")]
|
||||
public virtual async Task<ActionResult> TagsDetach(
|
||||
[FromRoute] Guid id,
|
||||
[FromQuery] string tags
|
||||
)
|
||||
{
|
||||
//
|
||||
// Do ...
|
||||
try
|
||||
{
|
||||
//
|
||||
// Retrieve User Info ...
|
||||
var userInfo = await GetUserInfo();
|
||||
var connectionId = GetConnectionId();
|
||||
|
||||
//
|
||||
var tagsList = tags.ParseListString<string>();
|
||||
await WebinarProvider
|
||||
.TagsDetach(
|
||||
id: id,
|
||||
tags: tagsList,
|
||||
userInfo: userInfo,
|
||||
connectionId: connectionId
|
||||
);
|
||||
|
||||
//
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//
|
||||
var result = GetExceptionActionResult(ex);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
@@ -106,6 +107,37 @@ namespace xWebinarService.Interfaces
|
||||
/// <returns></returns>
|
||||
Task<XQueryResult<XWebinarDto>> QueryWebinars(XQuery query);
|
||||
|
||||
/// <summary>
|
||||
/// Conditional Query Webinars ...
|
||||
/// </summary>
|
||||
/// <param name="whereClause"></param>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
Task<XQueryResult<XWebinarDto>> ConditionalQueryWebinars(
|
||||
Expression<Func<XWebinarDto, bool>> whereClause,
|
||||
XQuery query
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Query Owned Webinars ...
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
Task<XQueryResult<XWebinarDto>> QueryOwnedWebinars(
|
||||
XQuery query,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Query Joinable Webinars ...
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
Task<XQueryResult<XWebinarDto>> QueryJoinableWebinars(
|
||||
XQuery query,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Query Webinar Ids ...
|
||||
/// </summary>
|
||||
@@ -204,11 +236,13 @@ namespace xWebinarService.Interfaces
|
||||
/// <param name="forProvidedId"></param>
|
||||
/// <param name="files"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<XFileDto>> Upload(
|
||||
Guid id,
|
||||
IFormFileCollection files,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
@@ -217,11 +251,13 @@ namespace xWebinarService.Interfaces
|
||||
/// <param name="forProvidedId"></param>
|
||||
/// <param name="ids"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<Guid>> RemoveFiles(
|
||||
Guid id,
|
||||
string ids = null,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
@@ -240,12 +276,14 @@ namespace xWebinarService.Interfaces
|
||||
/// <param name="tag"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="forceAttachToFiles"></param>
|
||||
/// <returns></returns>
|
||||
Task TagAttach(
|
||||
string tag,
|
||||
Guid id,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null,
|
||||
bool forceAttachToFiles = true
|
||||
);
|
||||
|
||||
@@ -255,12 +293,14 @@ namespace xWebinarService.Interfaces
|
||||
/// <param name="tag"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="forceAttachToFiles"></param>
|
||||
/// <returns></returns>
|
||||
Task TagDetach(
|
||||
string tag,
|
||||
Guid id,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null,
|
||||
bool forceDetachFromFiles = true
|
||||
);
|
||||
|
||||
@@ -270,12 +310,14 @@ namespace xWebinarService.Interfaces
|
||||
/// <param name="tags"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="forceAttachToFiles"></param>
|
||||
/// <returns></returns>
|
||||
Task TagsAttach(
|
||||
IEnumerable<string> tags,
|
||||
Guid id,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null,
|
||||
bool forceAttachToFiles = true
|
||||
);
|
||||
|
||||
@@ -285,12 +327,14 @@ namespace xWebinarService.Interfaces
|
||||
/// <param name="tags"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="forceDetachFromFiles"></param>
|
||||
/// <returns></returns>
|
||||
Task TagsDetach(
|
||||
IEnumerable<string> tags,
|
||||
Guid id,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null,
|
||||
bool forceDetachFromFiles = true
|
||||
);
|
||||
|
||||
@@ -298,10 +342,14 @@ namespace xWebinarService.Interfaces
|
||||
/// Detach all Attached Tags for Specified File ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="forceDetachFromFiles"></param>
|
||||
/// <returns></returns>
|
||||
Task TagsDetach(
|
||||
Guid id,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null,
|
||||
bool forceDetachFromFiles = true
|
||||
);
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using xModels.Dtos;
|
||||
using xWebinarService.Models.Dtos;
|
||||
@@ -18,22 +19,32 @@ namespace xWebinarService.Interfaces
|
||||
/// Create Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="tags"></param>
|
||||
/// <param name="files"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<XWebinarDto>> CreateWebinar([FromBody] XWebinarDto item);
|
||||
Task<ActionResult<XWebinarDto>> CreateWebinar(
|
||||
[FromBody] XWebinarDto item,
|
||||
[FromQuery] string tags = null,
|
||||
[FromForm] IFormFileCollection files = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Update a Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<XWebinarDto>> UpdateWebinar([FromBody] XWebinarDto item);
|
||||
Task<ActionResult<XWebinarDto>> UpdateWebinar(
|
||||
[FromBody] XWebinarDto item
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<XWebinarDto>> GetWebinar([FromQuery] Guid id);
|
||||
Task<ActionResult<XWebinarDto>> GetWebinar(
|
||||
[FromQuery] Guid id
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve all Exists Webinars ...
|
||||
@@ -41,25 +52,32 @@ namespace xWebinarService.Interfaces
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<IEnumerable<XWebinarDto>>> GetWebinars();
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve all Exists Webinar Ids ...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
ActionResult<IEnumerable<Guid>> GetWebinarIds();
|
||||
|
||||
/// <summary>
|
||||
/// Query Webinars ...
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<XQueryResult<XWebinarDto>>> QueryWebinars([FromQuery] XQuery query);
|
||||
Task<ActionResult<XQueryResult<XWebinarDto>>> QueryWebinars(
|
||||
[FromQuery] XQuery query
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Query Webinar Ids ...
|
||||
/// Query Owned Webinars ...
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
ActionResult<XQueryResult<Guid>> QueryWebinarIds([FromQuery] XQuery query);
|
||||
Task<ActionResult<XQueryResult<XWebinarDto>>> QueryOwnedWebinars(
|
||||
[FromQuery] XQuery query
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Query Joinable Webinars ...
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<XQueryResult<XWebinarDto>>> QueryJoinableWebinars(
|
||||
[FromQuery] XQuery query
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Remove Specified Webinar ...
|
||||
@@ -143,5 +161,64 @@ namespace xWebinarService.Interfaces
|
||||
[FromQuery] Guid webinarId
|
||||
);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region File Actions ...
|
||||
/// <summary>
|
||||
/// Upload Specified Files for Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="files"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<IEnumerable<XFileDto>>> Upload(
|
||||
[FromRoute] Guid id,
|
||||
[FromForm] IFormFileCollection files
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Remove Specified (All) Files of Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<IEnumerable<XFileDto>>> Remove(
|
||||
[FromRoute] Guid id,
|
||||
[FromQuery] string ids = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve Specified Webinar's Files ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<IEnumerable<XFileDto>>> GetFiles(
|
||||
[FromRoute] Guid id
|
||||
);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Tags Actions ...
|
||||
/// <summary>
|
||||
/// Attach Specified Tags To Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="tags"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult> TagsAttach(
|
||||
[FromRoute] Guid id,
|
||||
[FromQuery] string tags
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Detach Specified Tags From Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="tags"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult> TagsDetach(
|
||||
[FromRoute] Guid id,
|
||||
[FromQuery] string tags
|
||||
);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+230
-21
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
@@ -334,6 +335,7 @@ namespace xWebinarService.Providers
|
||||
tags: tags,
|
||||
id: entity.Id,
|
||||
userInfo: userInfo,
|
||||
connectionId: connectionId,
|
||||
true //
|
||||
);
|
||||
}
|
||||
@@ -366,6 +368,10 @@ namespace xWebinarService.Providers
|
||||
string connectionId = null
|
||||
)
|
||||
{
|
||||
//
|
||||
// Since Medias and Tags Manages Separatly, here
|
||||
// we dont need to ensure that ...
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
bool isValid =
|
||||
@@ -584,7 +590,6 @@ namespace xWebinarService.Providers
|
||||
// Since in Resourceable Entities we have to Search on Locales
|
||||
// we Must Implement Senario Custom ...
|
||||
var totalEntities = await WebinarRepository.GetAllAsync();
|
||||
Console.WriteLine($"Query Reading All ...");
|
||||
|
||||
//
|
||||
var list = new List<XWebinarDto>();
|
||||
@@ -596,7 +601,6 @@ namespace xWebinarService.Providers
|
||||
}
|
||||
var items = list.AsEnumerable();
|
||||
var totalItemsCount = items.Count();
|
||||
Console.WriteLine($"Query Reading Item's Tasks ...");
|
||||
|
||||
//
|
||||
// Apply Filter ...
|
||||
@@ -605,9 +609,6 @@ namespace xWebinarService.Providers
|
||||
//
|
||||
items = items
|
||||
.ApplyFilter(query.Filter);
|
||||
|
||||
//
|
||||
Console.WriteLine($"Query Apply Filter ...");
|
||||
}
|
||||
int filteredItemsCount = items.Count();
|
||||
|
||||
@@ -629,8 +630,6 @@ namespace xWebinarService.Providers
|
||||
query.SortBy,
|
||||
query.IsAscending
|
||||
);
|
||||
//
|
||||
Console.WriteLine($"Query Apply Sorting ...");
|
||||
|
||||
//
|
||||
// Apply Paging ...
|
||||
@@ -640,8 +639,6 @@ namespace xWebinarService.Providers
|
||||
query.Page,
|
||||
query.PageSize
|
||||
);
|
||||
//
|
||||
Console.WriteLine($"Query Apply Paging ...");
|
||||
}
|
||||
|
||||
//
|
||||
@@ -661,6 +658,170 @@ namespace xWebinarService.Providers
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conditional Query Webinars ...
|
||||
/// </summary>
|
||||
/// <param name="whereClause"></param>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<XQueryResult<XWebinarDto>> ConditionalQueryWebinars(
|
||||
Expression<Func<XWebinarDto, bool>> whereClause,
|
||||
XQuery query
|
||||
)
|
||||
{
|
||||
//
|
||||
// Validate ...
|
||||
if (query.IsNull() || whereClause.IsNull())
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
// Normalize ...
|
||||
query = query.NormalizeQuery(DataSercviceConfiguration);
|
||||
|
||||
//
|
||||
// Compile Expression ...
|
||||
var whereFunc = whereClause.Compile();
|
||||
|
||||
//
|
||||
// Since in Resourceable Entities we have to Search on Locales
|
||||
// we Must Implement Senario Custom ...
|
||||
var totalEntities = await WebinarRepository.GetAllAsync();
|
||||
|
||||
//
|
||||
var list = new List<XWebinarDto>();
|
||||
foreach (var entity in totalEntities)
|
||||
{
|
||||
//
|
||||
var dto = await ToXWebinarDto(entity);
|
||||
|
||||
//
|
||||
// Validate and Check Conditions ...
|
||||
if (!dto.IsNullOrDefault() && whereFunc(dto))
|
||||
{
|
||||
list.Add(dto);
|
||||
}
|
||||
}
|
||||
var items = list.AsEnumerable();
|
||||
var totalItemsCount = items.Count();
|
||||
|
||||
//
|
||||
// Apply Filter ...
|
||||
if (!query.Filter.IsNullOrEmpty())
|
||||
{
|
||||
//
|
||||
items = items
|
||||
.ApplyFilter(query.Filter);
|
||||
}
|
||||
int filteredItemsCount = items.Count();
|
||||
|
||||
//
|
||||
// Count Pages ...
|
||||
var totalPagesCount = query.CountPages(totalItemsCount);
|
||||
var filteredPagesCount = query.CountPages(filteredItemsCount);
|
||||
|
||||
//
|
||||
// Apply Paging and Sorting ...
|
||||
if (totalItemsCount > 0 &&
|
||||
filteredItemsCount > 0)
|
||||
{
|
||||
//
|
||||
// Apply Sorting ...
|
||||
items = items
|
||||
.ToList()
|
||||
.ApplySorting(
|
||||
query.SortBy,
|
||||
query.IsAscending
|
||||
);
|
||||
|
||||
//
|
||||
// Apply Paging ...
|
||||
items = items
|
||||
.ToList()
|
||||
.ApplyPaging(
|
||||
query.Page,
|
||||
query.PageSize
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Prepare Result ...
|
||||
var result = new XQueryResult<XWebinarDto>
|
||||
{
|
||||
Page = query.Page,
|
||||
Items = items.ToList(),
|
||||
PageSize = query.PageSize,
|
||||
TotalPages = totalPagesCount,
|
||||
TotalItems = totalItemsCount,
|
||||
TotalFilteredPages = filteredPagesCount,
|
||||
TotalFilteredItems = filteredItemsCount
|
||||
};
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query Owned Webinars ...
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<XQueryResult<XWebinarDto>> QueryOwnedWebinars(
|
||||
XQuery query,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
)
|
||||
{
|
||||
//
|
||||
// Validate ...
|
||||
var isValid = !query.IsNullOrDefault() &&
|
||||
!userInfo.IsNullOrDefault();
|
||||
if (!isValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
Expression<Func<XWebinarDto, bool>> whereClause = d => d.OwnerId == userInfo.UserId;
|
||||
var result = await ConditionalQueryWebinars(
|
||||
query: query,
|
||||
whereClause: whereClause
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query Joinable Webinars ...
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<XQueryResult<XWebinarDto>> QueryJoinableWebinars(
|
||||
XQuery query,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
)
|
||||
{
|
||||
//
|
||||
// Validate ...
|
||||
var isValid = !query.IsNullOrDefault() &&
|
||||
!userInfo.IsNullOrDefault();
|
||||
if (!isValid)
|
||||
{
|
||||
XException.InvalidArgs.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
// Create an Expression to Check Specified Webinar is Joinable by Provided User Info or not ...
|
||||
Expression<Func<XWebinarDto, bool>> whereClause = d =>
|
||||
d.OwnerId == userInfo.UserId ||
|
||||
d.Type == XWebinarType.Public ||
|
||||
WebinarSubscriberRepository.AsQueryable().Any(ws => ws.WebinarId == d.Id && ws.SubscriberId == userInfo.UserId);
|
||||
var result = await ConditionalQueryWebinars(
|
||||
query: query,
|
||||
whereClause: whereClause
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Query Webinar Ids ...
|
||||
/// </summary>
|
||||
@@ -1246,11 +1407,13 @@ namespace xWebinarService.Providers
|
||||
/// <param name="forProvidedId"></param>
|
||||
/// <param name="files"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IEnumerable<XFileDto>> Upload(
|
||||
Guid id,
|
||||
IFormFileCollection files,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -1279,7 +1442,8 @@ namespace xWebinarService.Providers
|
||||
result = (await WebinarFileProvider.Upload(
|
||||
files: files,
|
||||
forProvidedId: id,
|
||||
userInfo: userInfo
|
||||
userInfo: userInfo,
|
||||
connectionId: connectionId
|
||||
))
|
||||
.ToList();
|
||||
}
|
||||
@@ -1295,11 +1459,13 @@ namespace xWebinarService.Providers
|
||||
/// <param name="forProvidedId"></param>
|
||||
/// <param name="ids"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IEnumerable<Guid>> RemoveFiles(
|
||||
Guid id,
|
||||
string ids = null,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -1322,9 +1488,10 @@ namespace xWebinarService.Providers
|
||||
|
||||
//
|
||||
var result = await WebinarFileProvider.Remove(
|
||||
id,
|
||||
ids,
|
||||
userInfo
|
||||
forProvidedId: id,
|
||||
ids: ids,
|
||||
userInfo: userInfo,
|
||||
connectionId: connectionId
|
||||
);
|
||||
return result;
|
||||
}
|
||||
@@ -1362,12 +1529,14 @@ namespace xWebinarService.Providers
|
||||
/// <param name="tag"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="forceAttachToFiles"></param>
|
||||
/// <returns></returns>
|
||||
public async Task TagAttach(
|
||||
string tag,
|
||||
Guid id,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null,
|
||||
bool forceAttachToFiles = true
|
||||
)
|
||||
{
|
||||
@@ -1395,7 +1564,7 @@ namespace xWebinarService.Providers
|
||||
{
|
||||
//
|
||||
// Attached Tag to Webinar ...
|
||||
await WebinarTagProvider.Attach(tag, id);
|
||||
await WebinarTagProvider.Attach(tag, id, connectionId);
|
||||
|
||||
//
|
||||
if (forceAttachToFiles)
|
||||
@@ -1408,7 +1577,13 @@ namespace xWebinarService.Providers
|
||||
//
|
||||
foreach (var media in medias)
|
||||
{
|
||||
await WebinarFileProvider.Provider.TagAttach(tag, media.Id);
|
||||
//
|
||||
await WebinarFileProvider.Provider.TagAttach(
|
||||
tag,
|
||||
media.Id,
|
||||
userInfo,
|
||||
connectionId
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1423,12 +1598,14 @@ namespace xWebinarService.Providers
|
||||
/// <param name="tag"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="forceAttachToFiles"></param>
|
||||
/// <returns></returns>
|
||||
public async Task TagDetach(
|
||||
string tag,
|
||||
Guid id,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null,
|
||||
bool forceDetachFromFiles = true
|
||||
)
|
||||
{
|
||||
@@ -1454,7 +1631,7 @@ namespace xWebinarService.Providers
|
||||
try
|
||||
{
|
||||
//
|
||||
await WebinarTagProvider.Detach(tag, id);
|
||||
await WebinarTagProvider.Detach(tag, id, connectionId);
|
||||
|
||||
//
|
||||
if (forceDetachFromFiles)
|
||||
@@ -1467,7 +1644,13 @@ namespace xWebinarService.Providers
|
||||
//
|
||||
foreach (var media in medias)
|
||||
{
|
||||
await WebinarFileProvider.Provider.TagDetach(tag, media.Id);
|
||||
//
|
||||
await WebinarFileProvider.Provider.TagDetach(
|
||||
tag,
|
||||
media.Id,
|
||||
userInfo,
|
||||
connectionId
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1482,12 +1665,14 @@ namespace xWebinarService.Providers
|
||||
/// <param name="tags"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="forceAttachToFiles"></param>
|
||||
/// <returns></returns>
|
||||
public async Task TagsAttach(
|
||||
IEnumerable<string> tags,
|
||||
Guid id,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null,
|
||||
bool forceAttachToFiles = true
|
||||
)
|
||||
{
|
||||
@@ -1521,6 +1706,7 @@ namespace xWebinarService.Providers
|
||||
tag,
|
||||
id,
|
||||
userInfo,
|
||||
connectionId,
|
||||
forceAttachToFiles
|
||||
);
|
||||
}
|
||||
@@ -1535,12 +1721,14 @@ namespace xWebinarService.Providers
|
||||
/// <param name="tags"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="forceDetachFromFiles"></param>
|
||||
/// <returns></returns>
|
||||
public async Task TagsDetach(
|
||||
IEnumerable<string> tags,
|
||||
Guid id,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null,
|
||||
bool forceDetachFromFiles = true
|
||||
)
|
||||
{
|
||||
@@ -1574,6 +1762,7 @@ namespace xWebinarService.Providers
|
||||
tag,
|
||||
id,
|
||||
userInfo,
|
||||
connectionId,
|
||||
forceDetachFromFiles
|
||||
);
|
||||
}
|
||||
@@ -1586,10 +1775,14 @@ namespace xWebinarService.Providers
|
||||
/// Detach all Attached Tags for Specified File ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="forceDetachFromFiles"></param>
|
||||
/// <returns></returns>
|
||||
public async Task TagsDetach(
|
||||
Guid id,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null,
|
||||
bool forceDetachFromFiles = true
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -1612,7 +1805,23 @@ namespace xWebinarService.Providers
|
||||
try
|
||||
{
|
||||
//
|
||||
var tags = await WebinarTagProvider.RemoveTagsFor(id);
|
||||
var tags = await WebinarTagProvider.RemoveTagsFor(id, connectionId);
|
||||
|
||||
//
|
||||
if (forceDetachFromFiles)
|
||||
{
|
||||
//
|
||||
var medias = await WebinarFileProvider.GetAllFor(id);
|
||||
if (!medias.IsNull() && medias.HasChild())
|
||||
{
|
||||
//
|
||||
foreach (var media in medias)
|
||||
{
|
||||
//
|
||||
await WebinarFileProvider.Provider.TagsDetach(media.Id, userInfo, connectionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user