code guidelines
This commit is contained in:
@ -69,7 +69,7 @@ namespace Yavsc.Controllers
|
||||
|
||||
|
||||
[Authorize(Roles = Constants.AdminGroupName)]
|
||||
public IActionResult Index(string page, string len)
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
@ -591,7 +591,7 @@ namespace Yavsc.Controllers
|
||||
// GET: /Account/ResetPassword
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public async Task<IActionResult> ResetPassword(string UserId, string code = null)
|
||||
public async Task<IActionResult> ResetPassword(string UserId)
|
||||
{
|
||||
var user = await _userManager.FindByIdAsync(UserId);
|
||||
if (user==null) return new BadRequestResult();
|
||||
|
@ -195,9 +195,9 @@ namespace Yavsc.Controllers
|
||||
// Generate the token and send it
|
||||
var user = await GetCurrentUserAsync();
|
||||
var code = await _userManager.GenerateChangePhoneNumberTokenAsync(user, model.PhoneNumber);
|
||||
// TODO await _smsSender.SendSmsAsync(_twilioSettings, model.PhoneNumber, "Your security code is: " + code);
|
||||
// TODO ? await _smsSender.SendSmsAsync(_twilioSettings, model.PhoneNumber, "Your security code is: " + code);
|
||||
|
||||
return RedirectToAction(nameof(VerifyPhoneNumber), new { PhoneNumber = model.PhoneNumber });
|
||||
return RedirectToAction(nameof(VerifyPhoneNumber), new { model.PhoneNumber });
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -20,25 +20,12 @@ namespace Yavsc.Controllers
|
||||
[AllowAnonymous]
|
||||
public class OAuthController : Controller
|
||||
{
|
||||
readonly ApplicationDbContext _context;
|
||||
readonly UserManager<ApplicationUser> _userManager;
|
||||
readonly SiteSettings _siteSettings;
|
||||
readonly ILogger _logger;
|
||||
private readonly SignInManager<ApplicationUser> _signInManager;
|
||||
|
||||
public OAuthController(ApplicationDbContext context, SignInManager<ApplicationUser> signInManager, IKeyManager keyManager,
|
||||
UserManager<ApplicationUser> userManager,
|
||||
IOptions<SiteSettings> siteSettings,
|
||||
ILoggerFactory loggerFactory
|
||||
)
|
||||
public OAuthController(ILoggerFactory loggerFactory)
|
||||
{
|
||||
_siteSettings = siteSettings.Value;
|
||||
_context = context;
|
||||
_signInManager = signInManager;
|
||||
_userManager = userManager;
|
||||
_logger = loggerFactory.CreateLogger<OAuthController>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpGet("~/api/getclaims"), Produces("application/json")]
|
||||
|
@ -13,10 +13,9 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
public class AnnouncesController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
IStringLocalizer<AnnouncesController> _localizer;
|
||||
|
||||
IAuthorizationService _authorizationService;
|
||||
private readonly ApplicationDbContext _context;
|
||||
readonly IStringLocalizer<AnnouncesController> _localizer;
|
||||
readonly IAuthorizationService _authorizationService;
|
||||
|
||||
public AnnouncesController(ApplicationDbContext context,
|
||||
IAuthorizationService authorizationService,
|
||||
@ -61,9 +60,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
ViewBag.IsAdmin = User.IsInRole(Constants.AdminGroupName);
|
||||
ViewBag.IsPerformer = User.IsInRole(Constants.PerformerGroupName);
|
||||
ViewBag.AllowEdit = (announce!=null && announce.Id>0) ?
|
||||
await _authorizationService.AuthorizeAsync(User,announce,new EditRequirement()) :
|
||||
true;
|
||||
ViewBag.AllowEdit = announce==null || announce.Id<=0 || await _authorizationService.AuthorizeAsync(User,announce,new EditRequirement());
|
||||
List<SelectListItem> dl = new List<SelectListItem>();
|
||||
var rnames = System.Enum.GetNames(typeof(Reason));
|
||||
var rvalues = System.Enum.GetValues(typeof(Reason));
|
||||
|
@ -40,7 +40,7 @@ namespace Yavsc.Controllers
|
||||
|
||||
// GET: Blog
|
||||
[AllowAnonymous]
|
||||
public async Task<IActionResult> Index(string id, int skip=0, int maxLen=25)
|
||||
public async Task<IActionResult> Index(string id)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(id)) {
|
||||
return await UserPosts(id);
|
||||
|
@ -11,7 +11,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
public class CoWorkingController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public CoWorkingController(ApplicationDbContext context)
|
||||
{
|
||||
|
@ -90,7 +90,7 @@ namespace Yavsc.Controllers
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public IActionResult Create(string proId, string activityCode, string billingCode)
|
||||
public IActionResult Create(string proId, string activityCode)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(proId))
|
||||
throw new InvalidOperationException(
|
||||
@ -159,7 +159,7 @@ namespace Yavsc.Controllers
|
||||
_context.RdvQueries.Add(command, GraphBehavior.IncludeDependents);
|
||||
_context.SaveChanges(User.GetUserId());
|
||||
|
||||
var yaev = command.CreateEvent(_localizer, "NewCommand");
|
||||
var yaev = command.CreateEvent("NewCommand");
|
||||
|
||||
MessageWithPayloadResponse nrep = null;
|
||||
|
||||
|
@ -11,7 +11,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
public class CommandFormsController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public CommandFormsController(ApplicationDbContext context)
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
public class DjSettingsController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public DjSettingsController(ApplicationDbContext context)
|
||||
{
|
||||
|
@ -21,10 +21,9 @@ namespace Yavsc.Controllers
|
||||
[Authorize]
|
||||
public class EstimateController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private SiteSettings _site;
|
||||
|
||||
IAuthorizationService authorizationService;
|
||||
private readonly ApplicationDbContext _context;
|
||||
private readonly SiteSettings _site;
|
||||
readonly IAuthorizationService authorizationService;
|
||||
|
||||
public EstimateController(ApplicationDbContext context, IAuthorizationService authorizationService, IOptions<SiteSettings> siteSettings)
|
||||
{
|
||||
@ -143,10 +142,6 @@ namespace Yavsc.Controllers
|
||||
}
|
||||
|
||||
|
||||
private void Save(ICollection<IFormFile> newGraphics,
|
||||
ICollection<IFormFile> newFiles) {
|
||||
|
||||
}
|
||||
// GET: Estimate/Edit/5
|
||||
public IActionResult Edit(long? id)
|
||||
{
|
||||
|
@ -9,7 +9,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
public class FormsController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public FormsController(ApplicationDbContext context)
|
||||
{
|
||||
|
@ -18,13 +18,11 @@ namespace Yavsc.Controllers
|
||||
|
||||
public class FrontOfficeController : Controller
|
||||
{
|
||||
ApplicationDbContext _context;
|
||||
UserManager<ApplicationUser> _userManager;
|
||||
|
||||
ILogger _logger;
|
||||
|
||||
IStringLocalizer _SR;
|
||||
private IBillingService _billing;
|
||||
readonly ApplicationDbContext _context;
|
||||
readonly UserManager<ApplicationUser> _userManager;
|
||||
readonly ILogger _logger;
|
||||
readonly IStringLocalizer _SR;
|
||||
private readonly IBillingService _billing;
|
||||
|
||||
public FrontOfficeController(ApplicationDbContext context,
|
||||
UserManager<ApplicationUser> userManager,
|
||||
|
@ -8,7 +8,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
public class GeneralSettingsController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public GeneralSettingsController(ApplicationDbContext context)
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ namespace Yavsc.Controllers
|
||||
using Models.Musical;
|
||||
public class MusicalTendenciesController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public MusicalTendenciesController(ApplicationDbContext context)
|
||||
{
|
||||
|
@ -10,7 +10,7 @@ namespace Yavsc.Controllers
|
||||
[Authorize(Roles="Administrator")]
|
||||
public class SIRENExceptionsController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public SIRENExceptionsController(ApplicationDbContext context)
|
||||
{
|
||||
|
@ -6,10 +6,8 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
public class FileSystemController : Controller
|
||||
{
|
||||
ILogger _logger;
|
||||
public FileSystemController(ILoggerFactory loggerFactory)
|
||||
public FileSystemController()
|
||||
{
|
||||
_logger = loggerFactory.CreateLogger<FileSystemController>();
|
||||
}
|
||||
|
||||
public IActionResult Index(string subdir="")
|
||||
@ -21,4 +19,4 @@ namespace Yavsc.Controllers
|
||||
return View(files);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
public class ColorsController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public ColorsController(ApplicationDbContext context)
|
||||
{
|
||||
|
@ -29,6 +29,7 @@ namespace Yavsc.Controllers
|
||||
|
||||
public class HairCutCommandController : CommandController
|
||||
{
|
||||
readonly PayPalSettings payPalSettings;
|
||||
public HairCutCommandController(ApplicationDbContext context,
|
||||
IOptions<PayPalSettings> payPalSettings,
|
||||
IOptions<GoogleAuthSettings> googleSettings,
|
||||
@ -44,7 +45,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
this.payPalSettings = payPalSettings.Value;
|
||||
}
|
||||
PayPalSettings payPalSettings;
|
||||
|
||||
|
||||
private async Task<HairCutQuery> GetQuery(long id)
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
public class HairPrestationsController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public HairPrestationsController(ApplicationDbContext context)
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ namespace Yavsc.Controllers
|
||||
[Authorize("AdministratorOnly")]
|
||||
public class HairTaintsController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public HairTaintsController(ApplicationDbContext context)
|
||||
{
|
||||
|
@ -21,22 +21,19 @@ namespace Yavsc.Controllers
|
||||
[AllowAnonymous]
|
||||
public class HomeController : Controller
|
||||
{
|
||||
IHostingEnvironment _hosting;
|
||||
|
||||
ApplicationDbContext _dbContext;
|
||||
readonly ApplicationDbContext _dbContext;
|
||||
|
||||
readonly IHtmlLocalizer _localizer;
|
||||
public HomeController(IHtmlLocalizer<Startup> localizer, IHostingEnvironment hosting,
|
||||
ApplicationDbContext context, UserManager<ApplicationUser> userManager)
|
||||
public HomeController(IHtmlLocalizer<Startup> localizer,
|
||||
ApplicationDbContext context)
|
||||
{
|
||||
_localizer = localizer;
|
||||
_hosting = hosting;
|
||||
_dbContext = context;
|
||||
}
|
||||
|
||||
public async Task<IActionResult> Index(string id)
|
||||
{
|
||||
ViewBag.IsFromSecureProx = (Request.Headers.ContainsKey(Constants.SshHeaderKey)) ? Request.Headers[Constants.SshHeaderKey] == "on" : false;
|
||||
ViewBag.IsFromSecureProx = Request.Headers.ContainsKey(Constants.SshHeaderKey) && Request.Headers[Constants.SshHeaderKey] == "on";
|
||||
ViewBag.SecureHomeUrl = "https://" + Request.Headers["X-Forwarded-Host"];
|
||||
ViewBag.SshHeaderKey = Request.Headers[Constants.SshHeaderKey];
|
||||
var uid = User.GetUserId();
|
||||
|
@ -14,7 +14,7 @@ namespace Yavsc.Controllers
|
||||
[Authorize("AdministratorOnly")]
|
||||
public class GitController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public GitController(ApplicationDbContext context)
|
||||
{
|
||||
|
@ -17,13 +17,11 @@ namespace Yavsc.Controllers
|
||||
[Authorize("AdministratorOnly")]
|
||||
public class ProjectController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
ILogger _logger;
|
||||
IStringLocalizer<Yavsc.YavscLocalisation> _localizer;
|
||||
IStringLocalizer<BugController> _bugLocalizer;
|
||||
private readonly ApplicationDbContext _context;
|
||||
readonly IStringLocalizer<Yavsc.YavscLocalisation> _localizer;
|
||||
readonly IStringLocalizer<BugController> _bugLocalizer;
|
||||
|
||||
public ProjectController(ApplicationDbContext context,
|
||||
ILoggerFactory loggerFactory,
|
||||
IStringLocalizer<Yavsc.YavscLocalisation> localizer,
|
||||
IStringLocalizer<BugController> bugLocalizer
|
||||
)
|
||||
@ -31,14 +29,11 @@ namespace Yavsc.Controllers
|
||||
_context = context;
|
||||
_localizer = localizer;
|
||||
_bugLocalizer = bugLocalizer;
|
||||
_logger = loggerFactory.CreateLogger<ProjectController>();
|
||||
|
||||
}
|
||||
|
||||
// GET: Project
|
||||
public async Task<IActionResult> Index()
|
||||
{
|
||||
|
||||
var applicationDbContext = _context.Project.Include(p => p.Client).Include(p => p.Context).Include(p => p.PerformerProfile).Include(p => p.Regularisation).Include(p => p.Repository);
|
||||
return View(await applicationDbContext.ToListAsync());
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
public class InstrumentRatingController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public InstrumentRatingController(ApplicationDbContext context)
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ namespace Yavsc.Controllers
|
||||
[Authorize]
|
||||
public class InstrumentationController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public InstrumentationController(ApplicationDbContext context)
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ namespace Yavsc.Controllers
|
||||
using Models.Musical;
|
||||
public class InstrumentsController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public InstrumentsController(ApplicationDbContext context)
|
||||
{
|
||||
|
@ -14,9 +14,9 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
public class BugController : Controller
|
||||
{
|
||||
ApplicationDbContext _context;
|
||||
IStringLocalizer<BugController> _localizer;
|
||||
IStringLocalizer<Yavsc.Models.IT.Fixing.Resources> _statusLocalizer;
|
||||
readonly ApplicationDbContext _context;
|
||||
readonly IStringLocalizer<BugController> _localizer;
|
||||
readonly IStringLocalizer<Yavsc.Models.IT.Fixing.Resources> _statusLocalizer;
|
||||
|
||||
public BugController(ApplicationDbContext context,
|
||||
IStringLocalizer<BugController> localizer,
|
||||
|
@ -14,8 +14,8 @@ namespace Yavsc.Controllers
|
||||
|
||||
public class FeatureController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
private IStringLocalizer<BugController> _bugLocalizer;
|
||||
private readonly ApplicationDbContext _context;
|
||||
private readonly IStringLocalizer<BugController> _bugLocalizer;
|
||||
|
||||
IEnumerable<SelectListItem> Statuses(FeatureStatus ?status) =>
|
||||
_bugLocalizer.CreateSelectListItems(typeof(FeatureStatus), status);
|
||||
|
Reference in New Issue
Block a user