Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Query"/> class.
 /// </summary>
 /// <param name="labelRepo">The label repo.</param>
 /// <param name="toDoItemRepo">To do item repo.</param>
 /// <param name="toDoListRepo">To do list repo.</param>
 /// <param name="userRepo">The user repo.</param>
 /// <param name="httpContextAccessor">The HTTP context accessor.</param>
 public Query([Service] ILabelRepo labelRepo, [Service] IToDoItemRepo toDoItemRepo, [Service] IToDoListRepo toDoListRepo,
              [Service] IUserRepo userRepo, IHttpContextAccessor httpContextAccessor)
 {
     _labelRepo    = labelRepo;
     _toDoItemRepo = toDoItemRepo;
     _toDoListRepo = toDoListRepo;
     _userRepo     = userRepo;
     if (httpContextAccessor.HttpContext.Items["UserId"] != null)
     {
         _userId = int.Parse(httpContextAccessor.HttpContext.Items["UserId"].ToString());
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="Mutation"/> class.
 /// </summary>
 /// <param name="labelRepo">The label repo.</param>
 /// <param name="toDoItemRepo">To do item repo.</param>
 /// <param name="toDoListRepo">To do list repo.</param>
 /// <param name="userRepo">The user repo.</param>
 /// <param name="httpContextAccessor">The HTTP context accessor.</param>
 /// <param name="tokenConfig">The token configuration.</param>
 public Mutation([Service] ILabelRepo labelRepo, [Service] IToDoItemRepo toDoItemRepo, [Service] IToDoListRepo toDoListRepo,
                 [Service] IUserRepo userRepo, IHttpContextAccessor httpContextAccessor, IOptions <JwtTokenConfig> tokenConfig)
 {
     _labelRepo    = labelRepo;
     _toDoItemRepo = toDoItemRepo;
     _toDoListRepo = toDoListRepo;
     _userRepo     = userRepo;
     _tokenConfig  = tokenConfig.Value;
     if (httpContextAccessor.HttpContext.Items["UserId"] != null)
     {
         _userId = int.Parse(httpContextAccessor.HttpContext.Items["UserId"].ToString());
     }
 }
Exemple #3
0
 public TaskController(UserManager <UserModel> userManager, IToDoListRepo repository)
 {
     UserMgr     = userManager;
     _repository = repository;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ToDoListService"/> class.
 /// </summary>
 /// <param name="toDoListRepository">To do list repository.</param>
 /// <param name="mapper">The mapper.</param>
 public ToDoListService(IToDoListRepo toDoListRepository, IMapper mapper)
 {
     this._toDoListRepository = toDoListRepository;
     this._mapper             = mapper;
 }