Implement file upload
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
using Hcs.WebApp.Data.Hcs;
|
||||
using Hcs.WebApp.Data.Hcs.CampaignArgs;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Hcs.WebApp.Services
|
||||
@ -69,7 +70,7 @@ namespace Hcs.WebApp.Services
|
||||
select operation).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<Campaign> InitiateCampaignAsync(Campaign.CampaignType type, string initiatorId)
|
||||
public async Task<Campaign> InitiateCampaignAsync(Campaign.CampaignType type, string initiatorId, ICampaignArgs? args = null)
|
||||
{
|
||||
using var context = GetNewContext();
|
||||
var campaign = new Campaign()
|
||||
@ -78,6 +79,12 @@ namespace Hcs.WebApp.Services
|
||||
InitiatorId = initiatorId,
|
||||
CreatedAt = DateTime.UtcNow
|
||||
};
|
||||
|
||||
if (args != null)
|
||||
{
|
||||
campaign.SerializeArgs(args);
|
||||
}
|
||||
|
||||
await context.Campaigns.AddAsync(campaign);
|
||||
await context.SaveChangesAsync();
|
||||
return campaign;
|
||||
|
||||
Reference in New Issue
Block a user