This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BrowserSpecificAttribute : ActionFilterAttribute | |
{ | |
public override void OnResultExecuting(ResultExecutingContext filterContext) | |
{ | |
var viewResult = filterContext.Result as ViewResult; | |
if (viewResult == null) | |
return; | |
// Figure out the view name | |
var context = filterContext.Controller.ControllerContext; | |
var viewName = viewResult.ViewName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AjaxOnlyAttribute : ActionMethodSelectorAttribute | |
{ | |
public override Boolean IsValidForRequest( | |
ControllerContext controllerContext, MethodInfo methodInfo) | |
{ | |
return controllerContext.HttpContext.Request.IsAjaxRequest(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IQueryable<Entity> GetAllIncluding(params Expression<Func<Entity, object>>[] includedProperties) | |
{ | |
IQueryable<Entity> query = db.Groups; | |
foreach (var includedProperty in includedProperties) | |
{ | |
query = query.Include(includedProperty); | |
} | |
return query; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GenericRepository<T> : IRepository<T> where T: class | |
{ | |
private readonly DbContext _context; | |
private IDbSet<T> dbSet; | |
public GenericRepository(DbContext context) | |
{ | |
_context = context; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).on('click', 'button.save', function (event) { | |
$.validator.unobtrusive.parse('#InspectionScopeForm'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Mvc.ModelBinding; | |
using Newtonsoft.Json; | |
using System; | |
using System.Threading.Tasks; | |
namespace AcerPlatformV2.Presentation.Helpers | |
{ | |
/// <summary> | |
/// This model binder resolve a JsonString to A List Of T | |
/// </summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// <copyright file="CustomClaimsPrincipalFactory.cs" company=""> | |
// Copyright (c) | |
// </copyright> | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Security.Claims; | |
using System.Threading.Tasks; | |
using Platform.Business.Interfaces; | |
using Platform.Domain.Entities; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace AcerPlatformV2.Business.Services | |
{ | |
public class TransactionService : ITransactionService | |
{ | |
private IDbContextTransaction _transaction; | |
private readonly IUnitOfWork _unitOfWork; | |
public TransactionService(IUnitOfWork unitOfWork) | |
{ | |
_unitOfWork = unitOfWork; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TODO: Move to Infrastructıre. | |
public static class PredicateBuilder | |
{ | |
public static Expression<Func<T, bool>> True<T>() { return f => true; } | |
public static Expression<Func<T, bool>> False<T>() { return f => false; } | |
public static Expression<Func<T, bool>> Or<T>(this Expression<Func<T, bool>> expr1, | |
Expression<Func<T, bool>> expr2) | |
{ | |
var invokedExpr = Expression.Invoke(expr2, expr1.Parameters.Cast<Expression>()); |
OlderNewer