#106 add site banner method
This commit is contained in:
parent
26dd8ba482
commit
24865be93f
@ -246,5 +246,11 @@ namespace RMuseum.DbContext
|
||||
public DbSet<GanjoorPageSnapshot> GanjoorPageSnapshots { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Ganjoor Site Bannaers
|
||||
/// </summary>
|
||||
public DbSet<GanjoorSiteBanner> GanjoorSiteBanners { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,12 +16,12 @@ namespace RMuseum.Models.Ganjoor
|
||||
/// <summary>
|
||||
/// banner image
|
||||
/// </summary>
|
||||
public virtual RImage RImage { get; set; }
|
||||
public RImage RImage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// image id
|
||||
/// </summary>
|
||||
public Guid? RImageId { get; set; }
|
||||
public Guid RImageId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// alternate text
|
||||
|
||||
@ -1418,6 +1418,11 @@
|
||||
Ganjoor Page Snapshots
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.DbContext.RMuseumDbContext.GanjoorSiteBanners">
|
||||
<summary>
|
||||
Ganjoor Site Bannaers
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:RMuseum.Models.Artifact.PublishStatus">
|
||||
<summary>
|
||||
Items or pictures status
|
||||
@ -6659,6 +6664,17 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IGanjoorService.AddSiteBanner(System.IO.Stream,System.String,System.String,System.String,System.Boolean)">
|
||||
<summary>
|
||||
Add site banner
|
||||
</summary>
|
||||
<param name="imageStream"></param>
|
||||
<param name="fileName"></param>
|
||||
<param name="alternateText"></param>
|
||||
<param name="targetUrl"></param>
|
||||
<param name="active"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IGanjoorService.Faal">
|
||||
<summary>
|
||||
get a random poem from hafez
|
||||
@ -7679,6 +7695,17 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.GanjoorService.AddSiteBanner(System.IO.Stream,System.String,System.String,System.String,System.Boolean)">
|
||||
<summary>
|
||||
Add site banner
|
||||
</summary>
|
||||
<param name="imageStream"></param>
|
||||
<param name="fileName"></param>
|
||||
<param name="alternateText"></param>
|
||||
<param name="targetUrl"></param>
|
||||
<param name="active"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="F:RMuseum.Services.Implementation.GanjoorService._context">
|
||||
<summary>
|
||||
Database Context
|
||||
@ -7704,7 +7731,12 @@
|
||||
Messaging service
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.GanjoorService.#ctor(RMuseum.DbContext.RMuseumDbContext,Microsoft.Extensions.Configuration.IConfiguration,RSecurityBackend.Services.IBackgroundTaskQueue,RSecurityBackend.Services.IAppUserService,RSecurityBackend.Services.IRNotificationService)">
|
||||
<member name="F:RMuseum.Services.Implementation.GanjoorService._imageFileService">
|
||||
<summary>
|
||||
Image File Service
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.GanjoorService.#ctor(RMuseum.DbContext.RMuseumDbContext,Microsoft.Extensions.Configuration.IConfiguration,RSecurityBackend.Services.IBackgroundTaskQueue,RSecurityBackend.Services.IAppUserService,RSecurityBackend.Services.IRNotificationService,RSecurityBackend.Services.IImageFileService)">
|
||||
<summary>
|
||||
constructor
|
||||
</summary>
|
||||
@ -7713,6 +7745,7 @@
|
||||
<param name="backgroundTaskQueue"></param>
|
||||
<param name="appUserService"></param>
|
||||
<param name="notificationService"></param>
|
||||
<param name="imageFileService"></param>
|
||||
</member>
|
||||
<member name="T:RMuseum.Services.Implementation.ImportedFromDesktopGanjoor.GPersianTextSync">
|
||||
<summary>
|
||||
|
||||
@ -3,6 +3,7 @@ using RMuseum.Models.Ganjoor.ViewModels;
|
||||
using RMuseum.Models.GanjoorAudio.ViewModels;
|
||||
using RSecurityBackend.Models.Generic;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RMuseum.Services
|
||||
@ -257,6 +258,17 @@ namespace RMuseum.Services
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<GanjoorMetre[]>> GetGanjoorMetres();
|
||||
|
||||
/// <summary>
|
||||
/// Add site banner
|
||||
/// </summary>
|
||||
/// <param name="imageStream"></param>
|
||||
/// <param name="fileName"></param>
|
||||
/// <param name="alternateText"></param>
|
||||
/// <param name="targetUrl"></param>
|
||||
/// <param name="active"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<GanjoorSiteBanner>> AddSiteBanner(Stream imageStream, string fileName, string alternateText, string targetUrl, bool active);
|
||||
|
||||
/// <summary>
|
||||
/// get a random poem from hafez
|
||||
/// </summary>
|
||||
|
||||
@ -17,6 +17,8 @@ using System.Threading.Tasks;
|
||||
using RMuseum.Models.Artifact;
|
||||
using RSecurityBackend.Services.Implementation;
|
||||
using DNTPersianUtils.Core;
|
||||
using System.IO;
|
||||
using RSecurityBackend.Models.Image;
|
||||
|
||||
namespace RMuseum.Services.Implementation
|
||||
{
|
||||
@ -1877,6 +1879,46 @@ namespace RMuseum.Services.Implementation
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add site banner
|
||||
/// </summary>
|
||||
/// <param name="imageStream"></param>
|
||||
/// <param name="fileName"></param>
|
||||
/// <param name="alternateText"></param>
|
||||
/// <param name="targetUrl"></param>
|
||||
/// <param name="active"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<GanjoorSiteBanner>> AddSiteBanner(Stream imageStream, string fileName, string alternateText, string targetUrl, bool active)
|
||||
{
|
||||
try
|
||||
{
|
||||
RServiceResult<RImage> image = await _imageFileService.Add(null, imageStream, fileName, "SiteBanners");
|
||||
|
||||
if (!string.IsNullOrEmpty(image.ExceptionString))
|
||||
{
|
||||
return new RServiceResult<GanjoorSiteBanner>(null, image.ExceptionString);
|
||||
}
|
||||
|
||||
GanjoorSiteBanner banner = new GanjoorSiteBanner()
|
||||
{
|
||||
RImageId = image.Result.Id,
|
||||
AlternateText = alternateText,
|
||||
TargetUrl = targetUrl,
|
||||
Active = active
|
||||
};
|
||||
|
||||
_context.GanjoorSiteBanners.Add(banner);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return new RServiceResult<GanjoorSiteBanner>(banner);
|
||||
|
||||
}
|
||||
catch(Exception exp)
|
||||
{
|
||||
return new RServiceResult<GanjoorSiteBanner>(null, exp.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Database Context
|
||||
/// </summary>
|
||||
@ -1903,6 +1945,11 @@ namespace RMuseum.Services.Implementation
|
||||
/// </summary>
|
||||
protected readonly IRNotificationService _notificationService;
|
||||
|
||||
/// <summary>
|
||||
/// Image File Service
|
||||
/// </summary>
|
||||
protected readonly IImageFileService _imageFileService;
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -1913,12 +1960,14 @@ namespace RMuseum.Services.Implementation
|
||||
/// <param name="backgroundTaskQueue"></param>
|
||||
/// <param name="appUserService"></param>
|
||||
/// <param name="notificationService"></param>
|
||||
public GanjoorService(RMuseumDbContext context, IConfiguration configuration, IBackgroundTaskQueue backgroundTaskQueue, IAppUserService appUserService, IRNotificationService notificationService)
|
||||
/// <param name="imageFileService"></param>
|
||||
public GanjoorService(RMuseumDbContext context, IConfiguration configuration, IBackgroundTaskQueue backgroundTaskQueue, IAppUserService appUserService, IRNotificationService notificationService, IImageFileService imageFileService)
|
||||
{
|
||||
_context = context;
|
||||
_backgroundTaskQueue = backgroundTaskQueue;
|
||||
_appUserService = appUserService;
|
||||
_notificationService = notificationService;
|
||||
_imageFileService = imageFileService;
|
||||
Configuration = configuration;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user