Merge pull request #221 from SychevIgor/ErrorInCatalogControllerFix
Error action extracted from CatalogController, because otherwise was …
This commit is contained in:
commit
229c250c05
@ -1,13 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.eShopOnContainers.WebMVC.ViewModels.Pagination;
|
using Microsoft.eShopOnContainers.WebMVC.ViewModels.Pagination;
|
||||||
using Microsoft.eShopOnContainers.WebMVC.Services;
|
using Microsoft.eShopOnContainers.WebMVC.Services;
|
||||||
using Microsoft.eShopOnContainers.WebMVC.ViewModels.CatalogViewModels;
|
using Microsoft.eShopOnContainers.WebMVC.ViewModels.CatalogViewModels;
|
||||||
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
||||||
{
|
{
|
||||||
public class CatalogController : Controller
|
public class CatalogController : Controller
|
||||||
@ -42,8 +39,5 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
|||||||
|
|
||||||
return View(vm);
|
return View(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Error() => View();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
9
src/Web/WebMVC/Controllers/ErrorController.cs
Normal file
9
src/Web/WebMVC/Controllers/ErrorController.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace WebMVC.Controllers
|
||||||
|
{
|
||||||
|
public class ErrorController : Controller
|
||||||
|
{
|
||||||
|
public IActionResult Error() => View();
|
||||||
|
}
|
||||||
|
}
|
@ -102,7 +102,7 @@ namespace Microsoft.eShopOnContainers.WebMVC
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
app.UseExceptionHandler("/Catalog/Error");
|
app.UseExceptionHandler("/Error");
|
||||||
}
|
}
|
||||||
|
|
||||||
app.UseSession();
|
app.UseSession();
|
||||||
@ -145,6 +145,10 @@ namespace Microsoft.eShopOnContainers.WebMVC
|
|||||||
routes.MapRoute(
|
routes.MapRoute(
|
||||||
name: "default",
|
name: "default",
|
||||||
template: "{controller=Catalog}/{action=Index}/{id?}");
|
template: "{controller=Catalog}/{action=Index}/{id?}");
|
||||||
|
|
||||||
|
routes.MapRoute(
|
||||||
|
name: "defaultError",
|
||||||
|
template: "{controller=Error}/{action=Error}");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user