Example #1
0
        public static async Task <User> BuildFromContext(NetWorthContext context, long userID)
        {
            var entity = await context.Users
                         .FindAsync(userID);

            if (entity == null)
            {
                throw new NotFoundException(nameof(User), userID);
            }

            var assets = await context.Assets.Where(a => a.UserID == userID).ToListAsync();

            var liabilities = await context.Liabilities.Where(l => l.UserID == userID).ToListAsync();

            foreach (Asset a in assets)
            {
                entity.Assets.Add(a);
            }
            foreach (Liability l in liabilities)
            {
                entity.Liabilities.Add(l);
            }

            return(entity);
        }
Example #2
0
 public Handler(
     NetWorthContext context,
     INotificationService notificationService,
     IMediator mediator)
 {
     _context             = context;
     _notificationService = notificationService;
     _mediator            = mediator;
 }
 public DeleteUserCommandHandler(NetWorthContext context)
 {
     _context = context;
 }
 public GetUserDetailQueryHandler(NetWorthContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
Example #5
0
 public UpdateCustomerCommandHandler(NetWorthContext context)
 {
     _context = context;
 }
Example #6
0
 public GetFactorQueryHandler(NetWorthContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
 public CreateFactorCommandHandler(NetWorthContext context)
 {
     _context = context;
 }
 public GetNetWorthQueryHandler(NetWorthContext context, IMapper mapper, IDateTime dateTime)
 {
     _context  = context;
     _mapper   = mapper;
     _dateTime = dateTime;
 }