mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-08 06:00:50 -07:00
Done #1012
This commit is contained in:
parent
beed3e858b
commit
635366261c
3 changed files with 69 additions and 40 deletions
|
@ -25,7 +25,10 @@
|
|||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Nancy;
|
||||
using Nancy.Responses.Negotiation;
|
||||
using Ombi.Core;
|
||||
using Ombi.Core.SettingModels;
|
||||
|
@ -48,6 +51,7 @@ namespace Ombi.UI.Modules.Admin
|
|||
Before += (ctx) => Security.AdminLoginRedirect(Permissions.Administrator, ctx);
|
||||
|
||||
Get["Index", "/faultqueue"] = x => Index();
|
||||
Get["DeleteFault", "/deleteFault", true] = async (x,ct) => await DeleteFault(Convert.ToInt32(Request.Form.id));
|
||||
}
|
||||
|
||||
private IRepository<RequestQueue> RequestQueue { get; }
|
||||
|
@ -69,5 +73,35 @@ namespace Ombi.UI.Modules.Admin
|
|||
|
||||
return View["RequestFaultQueue", model];
|
||||
}
|
||||
|
||||
public async Task<Response> DeleteFault(int faultId)
|
||||
{
|
||||
|
||||
if (faultId == 0)
|
||||
{
|
||||
return Response.AsJson(new JsonResponseModel
|
||||
{
|
||||
Result = true,
|
||||
Message = "Fault does not exist"
|
||||
});
|
||||
}
|
||||
|
||||
var fault = await RequestQueue.GetAsync(faultId);
|
||||
if (fault == null)
|
||||
{
|
||||
return Response.AsJson(new JsonResponseModel
|
||||
{
|
||||
Result = true,
|
||||
Message = "Fault does not exist"
|
||||
});
|
||||
}
|
||||
|
||||
await RequestQueue.DeleteAsync(fault);
|
||||
|
||||
return Response.AsJson(new JsonResponseModel
|
||||
{
|
||||
Result = true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue