public static EmployeeControllerHelper Create(IPrincipal principal, IEmployeeDbContext context = null)
        {
            if (principal.IsInRole("Admin"))
            {
                return(new AdminHelper());
            }

            if (principal.IsInRole("Client"))
            {
                if (context == null)
                {
                    throw new ArgumentNullException(nameof(context),
                                                    "For the \"Client\" role argument must be not null");
                }
                return(new ClientHelper(context));
            }
#if !DEBUG
            throw new InvalidOperationException("Incorrect user role for this operation");
#endif
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context),
                                                "For the \"Client\" role argument must be not null");
            }
            return(new ClientHelper(context));
        }
示例#2
0
 public ProjectController(EmployeeDbContext context)
 {
     this.context = context;
 }
示例#3
0
 public EmployeeController(EmployeeDbContext context)
 {
     this.context = context;
 }
示例#4
0
 public EmployeeRepository(IEmployeeDbContext context)
 {
     _context = context;
 }
示例#5
0
 //for tests only
 public EmployeeController(IEmployeeDbContext context, EmployeeControllerHelper helper)
 {
     db = context
          ?? new EmployeeDbContext();
     _helper = helper;
 }
示例#6
0
 //for tests only
 public EmployeeController(IEmployeeDbContext context)
 {
     db = context
          ?? new EmployeeDbContext();
 }
 public ClientHelper(IEmployeeDbContext context)
 {
     _context = context;
 }
示例#8
0
 /// <summary>
 /// EmployeeRepository
 /// </summary>
 /// <param name="employeedbContext">employeedbContext</param>
 public EmployeeRepository(IEmployeeDbContext <T> employeedbContext)
 {
     this.employeedbContext = employeedbContext;
 }
 public EmployeeRepository(IEmployeeDbContext context,
                           IEmployeeAdapter employeeAdapter)
 {
     Context         = context;
     EmployeeAdapter = employeeAdapter;
 }