-
Notifications
You must be signed in to change notification settings - Fork 1
/
MovieController.cs
39 lines (36 loc) · 1.22 KB
/
MovieController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
using System.Linq;
using JCTools.GenericCrud.Controllers;
using JCTools.GenericCrud.DataAnnotations;
using JCTools.GenericCrud.Services;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Logging;
using Test.Data;
using Test.Models;
namespace Test.Controllers
{
[CrudConstraint(typeof(Movie))]
public class MovieController : GenericController
{
public MovieController(
IServiceProvider serviceProvider,
IViewRenderService renderingService,
ILoggerFactory loggerFactory
)
: base(serviceProvider, renderingService, loggerFactory, nameof(Models.Movie.Id))
{
// add your custom logic here
}
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
// Call the initialization of the Settings property
base.InitSettings(filterContext);
// Add your custom settings here, eg;
Settings.UseModals = false;
Settings.Subtitle = "All entities";
ViewBag.Countries = (DbContext as Context).Countries.ToList();
base.OnActionExecuting(filterContext);
}
}
}