Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Linq.Expressions;

namespace DigitalLearningSolutions.Web.Controllers.FrameworksController
{
Expand Down Expand Up @@ -278,15 +279,25 @@ public IActionResult UploadResults()
return View("Developer/Import/UploadResults", model);
}
[Route("CancelImport")]
public IActionResult CancelImport()
public IActionResult CancelImport(int? frameworkId)
{
var data = GetBulkUploadData();
var frameworkId = data.FrameworkId;
if (!string.IsNullOrWhiteSpace(data.CompetenciesFileName))
try
{
FileHelper.DeleteFile(webHostEnvironment, data.CompetenciesFileName);
var data = GetBulkUploadData();
frameworkId = data.FrameworkId;
if (!string.IsNullOrWhiteSpace(data.CompetenciesFileName))
{
FileHelper.DeleteFile(webHostEnvironment, data.CompetenciesFileName);
}
}
catch
{

}
finally
{
TempData.Clear();
}
TempData.Clear();
return RedirectToAction("ViewFramework", new { frameworkId, tabname = "Structure" });
}
private void setupBulkUploadData(int frameworkId, int adminUserID, string competenciessFileName, string tabName, bool isNotBlank)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

public class ImportCompetenciesFormData
{
[Required(ErrorMessage = "Import competencies file is required")]
[AllowedExtensions([".xlsx"], "Import competencies file must be in xlsx format")]
[Required(ErrorMessage = "Import file is required")]
[AllowedExtensions([".xlsx"], "Import file must be in xlsx format")]
[MaxFileSize(5 * 1024 * 1024, "Maximum allowed file size is 5MB")]
public IFormFile? ImportFile { get; set; }
}
Expand Down
Loading
Loading