Add priority

This commit is contained in:
2017-02-01 09:41:08 -05:00
parent 0711ae0ac8
commit e3779a323c
19 changed files with 365 additions and 83 deletions
+31 -4
View File
@@ -16,9 +16,7 @@ namespace LeafWeb.WebCms.Controllers
{
public ActionResult Index()
{
var resultItems =
DataService.GetLeafInputs()
.OrderByDescending(f => f.Id);
var resultItems = DataService.GetLeafInputsOrdered();
string serviceDescription;
try
@@ -43,7 +41,10 @@ namespace LeafWeb.WebCms.Controllers
var leafInput = DataService.GetLeafInput(id);
if (leafInput == null)
{
SetStatusMessage($"LeafInput '${id}' not found, may have been deleted?");
RedirectToUmbracoPage(LeafWebPageIds.ManageQueue);
}
var viewModel = new LeafInputDetails(leafInput);
return View(viewModel);
@@ -150,7 +151,11 @@ namespace LeafWeb.WebCms.Controllers
public ActionResult SendUserDownloadLink(int id)
{
var leafInput = DataService.GetLeafInput(id);
if (!leafInput.IsComplete)
if (leafInput == null)
{
SetStatusMessage($"LeafInput '${id}' not found, may have been deleted?");
}
else if (!leafInput.IsComplete)
{
SetStatusMessage($"LeafInput '{leafInput.Identifier}' is not complete!", StatusType.Error);
}
@@ -164,6 +169,28 @@ namespace LeafWeb.WebCms.Controllers
return RedirectToCurrentUmbracoUrl();
}
[ActionLog]
public ActionResult Priority(int id, Priority priority)
{
var leafInput = DataService.GetLeafInput(id);
if (leafInput == null)
{
SetStatusMessage($"LeafInput '${id}' not found, may have been deleted?");
}
else if (!leafInput.IsPending)
{
SetStatusMessage($"LeafInput '{leafInput.Identifier}' is no longer pending");
}
else
{
leafInput.PendingPriority = priority;
DataService.UpdateLeafInput(leafInput);
SetStatusMessage($"LeafInput '{leafInput.Identifier}' priority set to '{leafInput.PendingPriority}'", StatusType.Success);
}
return RedirectToCurrentUmbracoUrl();
}
[ActionLog]
public ActionResult SendUserChartLink(int id)
{
+2 -6
View File
@@ -3,7 +3,6 @@ using System.Linq;
using System.Web.Mvc;
using LeafWeb.Core.Entities;
using LeafWeb.Core.Utility;
using LeafWeb.WebCms.Models;
namespace LeafWeb.WebCms.Controllers
{
@@ -13,12 +12,9 @@ namespace LeafWeb.WebCms.Controllers
{
var dateThreshold = DateTime.Today.Subtract(TimeSpan.FromDays(90));
var viewModel =
(
from li in DataService.GetLeafInputs()
from li in DataService.GetLeafInputsOrdered()
where li.Added >= dateThreshold
orderby li.Id descending
select li
);
select li;
return View(viewModel);
}