Details and queue management
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using Hangfire;
|
||||
using LeafWeb.Core.Entities;
|
||||
using LeafWeb.Core.Utility;
|
||||
using LeafWeb.WebCms.Models;
|
||||
using LeafWeb.WebCms.Services;
|
||||
|
||||
namespace LeafWeb.WebCms.Controllers
|
||||
{
|
||||
@@ -73,23 +75,45 @@ namespace LeafWeb.WebCms.Controllers
|
||||
return new FileContentResult(zip, "application/zip") { FileDownloadName = filename };
|
||||
}
|
||||
|
||||
[ActionLog]
|
||||
public ActionResult Delete(int id)
|
||||
{
|
||||
var leafInput = DataService.GetLeafInput(id);
|
||||
var viewModel = new LeafInputCreate();
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ActionLog]
|
||||
public ActionResult DeleteConfirmed(int id)
|
||||
{
|
||||
// TODO: don't allow currently running LeafInput to be deleted
|
||||
var leafInput = DataService.GetLeafInput(id);
|
||||
// don't allow currently running LeafInput to be deleted
|
||||
if (leafInput.IsRunning)
|
||||
{
|
||||
SetStatusMessage($"LeafInput '{leafInput.Identifier}' is currently running!", StatusType.Error);
|
||||
return View(Request.UrlReferrer.ToString());
|
||||
}
|
||||
|
||||
DataService.DeleteLeafInput(leafInput);
|
||||
|
||||
SetStatusMessage($"LeafInput '{leafInput.Identifier}' deleted");
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
[ActionLog]
|
||||
public ActionResult SendUserDownloadLink(int id)
|
||||
{
|
||||
var leafInput = DataService.GetLeafInput(id);
|
||||
if (!leafInput.IsComplete)
|
||||
{
|
||||
SetStatusMessage($"LeafInput '{leafInput.Identifier}' is not complete!", StatusType.Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
var leafInputId = leafInput.Id;
|
||||
BackgroundJob.Enqueue<EmailNotificationService>(e => e.SendLeafWebComplete(leafInputId));
|
||||
SetStatusMessage($"LeafInput '{leafInput.Identifier}' download link sent", StatusType.Success);
|
||||
}
|
||||
return View(Request.UrlReferrer.ToString());
|
||||
}
|
||||
|
||||
[ActionLog]
|
||||
public ActionResult SendUserChartLink(int id)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user