Implement file upload
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Hcs.WebApp.Data.Hcs.CampaignArgs;
|
||||
using Newtonsoft.Json;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Hcs.WebApp.Data.Hcs
|
||||
@ -35,9 +37,29 @@ namespace Hcs.WebApp.Data.Hcs
|
||||
|
||||
public string? FailureReason { get; set; }
|
||||
|
||||
public string? Args { get; set; }
|
||||
|
||||
public virtual ICollection<Operation>? Operations { get; set; } = null;
|
||||
|
||||
[NotMapped]
|
||||
public bool Completed => EndedAt.HasValue;
|
||||
|
||||
public ICampaignArgs? DeserializeArgs()
|
||||
{
|
||||
if (Args == null) return null;
|
||||
|
||||
return JsonConvert.DeserializeObject<ICampaignArgs>(Args, new JsonSerializerSettings()
|
||||
{
|
||||
TypeNameHandling = TypeNameHandling.Auto
|
||||
});
|
||||
}
|
||||
|
||||
public void SerializeArgs(ICampaignArgs args)
|
||||
{
|
||||
Args = JsonConvert.SerializeObject(args, Formatting.None, new JsonSerializerSettings()
|
||||
{
|
||||
TypeNameHandling = TypeNameHandling.Auto
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user