wabbajack/Wabbajack.Server/DTOs/ArchiveDownload.cs

30 lines
790 B
C#
Raw Normal View History

2020-05-14 04:08:27 +00:00
using System;
using System.Threading.Tasks;
2021-09-27 12:42:46 +00:00
using Wabbajack.DTOs;
2020-05-14 04:08:27 +00:00
using Wabbajack.Server.DataLayer;
2021-10-23 16:51:17 +00:00
namespace Wabbajack.Server.DTOs;
public class ArchiveDownload
2020-05-14 04:08:27 +00:00
{
2021-10-23 16:51:17 +00:00
public Guid Id { get; set; }
public Archive Archive { get; set; }
public bool? IsFailed { get; set; }
public DateTime? DownloadFinished { get; set; }
public string FailMessage { get; set; }
2020-05-14 04:08:27 +00:00
2021-10-23 16:51:17 +00:00
public async Task Fail(SqlService service, string message)
{
IsFailed = true;
DownloadFinished = DateTime.UtcNow;
FailMessage = message;
await service.UpdatePendingDownload(this);
}
2020-05-14 04:08:27 +00:00
2021-10-23 16:51:17 +00:00
public async Task Finish(SqlService service)
{
IsFailed = false;
DownloadFinished = DateTime.UtcNow;
await service.UpdatePendingDownload(this);
2020-05-14 04:08:27 +00:00
}
2021-10-23 16:51:17 +00:00
}