public override void OnActionExecuting(ActionExecutingContext context) { var uniqueCode = (Guid)context.ActionArguments["uniqueCode"]; var isCodeBurnt = _employerEmailDetailRepository.IsCodeBurnt(uniqueCode).Result; if (isCodeBurnt) { var employerEmailDetail = _employerEmailDetailRepository.GetEmployerInviteForUniqueCode(uniqueCode).GetAwaiter().GetResult(); var encodedAccountId = _encodingService.Encode(employerEmailDetail.AccountId, EncodingType.AccountId); var controller = context.Controller as Controller; context.Result = controller.RedirectToRoute(RouteNames.FeedbackAlreadySubmitted, new { encodedAccountId = encodedAccountId }); } }
public override void OnActionExecuting(ActionExecutingContext context) { if (context.ActionArguments.ContainsKey("uniqueCode")) { var uniqueCode = (Guid)context.ActionArguments["uniqueCode"]; var isCodeBurnt = _employerEmailDetailRepository.IsCodeBurnt(uniqueCode).Result; if (isCodeBurnt) { var dateCodeBurnt = _employerEmailDetailRepository.GetCodeBurntDate(uniqueCode).GetAwaiter().GetResult(); if (dateCodeBurnt.HasValue) { var daysSinceFeedback = DateTime.Now - dateCodeBurnt.Value; if (daysSinceFeedback.TotalDays > _config.FeedbackWaitPeriodDays) { return; } } var controller = context.Controller as Controller; context.Result = controller.RedirectToRoute(RouteNames.FeedbackAlreadySubmitted); } } }