Example #1
0
        public async Task <IActionResult> OnPostReOpenAsync([FromRoute] Guid id, [FromServices] IHelpRequestService helpRequestService)
        {
            var user = await _userManager.GetUserAsync(User);

            if (user == null)
            {
                return(RedirectToPage("/Error"));
            }

            Issue = await _context.Issues.FindAsync(id);

            if (Issue == null || user.Id != Issue.OwnerId)
            {
                return(RedirectToPage("/NotFound", new { message = "Your issue may have been removed or moved. Return home to view all your issues." }));
            }

            Issue.IsSolved = false;

            await _context.Entry(Issue).Collection(i => i.HelpRequests).LoadAsync();

            if (Issue.HelpRequests.Where(hr => hr.Status != HelpRequestStatus.Declined).Count() == 0)
            {
                await helpRequestService.RequestHelpAsync(Issue);
            }

            await _context.SaveChangesAsync();

            return(RedirectToPage("Single", new { id = id }));
        }
Example #2
0
 public NewModel(ApplicationDbContext context, ILogger <NewModel> logger, UserManager <ApplicationUser> userManager, IHelpRequestService helpRequestService)
 {
     _context            = context;
     _logger             = logger;
     _userManager        = userManager;
     _helpRequestService = helpRequestService;
 }
Example #3
0
 public HelpRequestController(IHelpRequestService helpRequestService,
                              PagingResultFactory pagingResultFactory,
                              INotificationService notificationService,
                              IHelpRequestResponseService helpRequestResponseService)
 {
     _helpRequestService         = helpRequestService;
     _pagingResultFactory        = pagingResultFactory;
     _notificationService        = notificationService;
     _helpRequestResponseService = helpRequestResponseService;
 }
 public HelpRequestResponseController(
     ILanguageService languageService,
     IHelpRequestResponseService helpRequestResponseService,
     IClientConfigurationService clientConfigurationService,
     IHelpRequestService helpRequestService,
     IClientService clientService,
     INotificationService notificationService)
     : base(languageService)
 {
     _clientService              = clientService;
     _helpRequestService         = helpRequestService;
     _helpRequestResponseService = helpRequestResponseService;
     _clientConfigurationService = clientConfigurationService;
     _notificationService        = notificationService;
 }
Example #5
0
        public async Task <IActionResult> OnPostMoreHelpAsync([FromRoute] Guid id, [FromServices] IHelpRequestService helpRequestService)
        {
            var user = await _userManager.GetUserAsync(User);

            if (user == null)
            {
                return(RedirectToPage("/Error"));
            }

            Issue = await _context.Issues.FindAsync(id);

            if (Issue == null || user.Id != Issue.OwnerId)
            {
                return(RedirectToPage("/NotFound", new { message = "Your issue may have been removed or moved. Return home to view all your issues." }));
            }

            await helpRequestService.RequestHelpAsync(Issue);

            return(RedirectToPage("Single", new { id = id }));
        }
 public HelpRequestController(ApiContext context, IHelpRequestService helpRequestService, IMapper mapper)
 {
     _context = context;
     this._helpRequestService = helpRequestService;
     this._mapper             = mapper;
 }
 public DashboardController(IHelpRequestService helpRequestService)
 {
     _helpRequestService = helpRequestService;
 }