ID未显示在参数中

时间:2015-09-24 01:45:36

标签: asp.net-mvc

我有一个向用户发送电子邮件的代码。在电子邮件中,有一个链接,他们应该访问相应的ID,以便将它们定向到某个页面。

这是我的代码:

public class DialogueFactory implements VoiceXmlDialogueFactory {

    @Override
    public VoiceXmlDialogue create(
            DialogueInitializationInfo<VoiceXmlInputTurn, VoiceXmlOutputTurn, VoiceXmlDialogueContext> initializationInfo)
            throws DialogueFactoryException {

        if (!(initializationInfo instanceof WebDialogueInitializationInfo))
            throw new DialogueFactoryException("Can only work in web mode.");

        WebDialogueInitializationInfo<?, ?, ?> webInitializationInfo = 
            (WebDialogueInitializationInfo<?, ?, ?>) initializationInfo;

        String dialogueType = webInitializationInfo.getHttpServletRequest().getParameter("type");

        // Then use dialogueType to build the right kind of Dialogue.
    }
}

在这一行:public void Notify(int appr_id = 0) { var check = db.rms_approval_routing.Where(s => s.appr_id == appr_id && s.appr_isactive == true).FirstOrDefault(); try { if (check != null) { check.status_id = 8; db.Entry(check).State = EntityState.Modified; db.SaveChanges(); var getinfo = db.rms_approval_route_vw.Where(s => s.appr_id == appr_id && s.appr_isactive == true).FirstOrDefault(); var getpayment = db.rms_payment.Where(s => s.appr_id == appr_id).FirstOrDefault(); if (getinfo != null && getpayment != null) { var ref_email = getinfo.ref_email; var cc_email = getinfo.user_email; var pay = getpayment.p_amount; var body = ""; body = "Good day!<br><br>Please be informed that you have successfully referred &nbsp;<u>" + getinfo.Fullname + "</u> and you are entitled to receive <u>P &nbsp;" + pay + "</u> which will be credited on the next payout for your successful referral.<br>Kindly visit the link to acknowledge the payment: http://localhost:8119/ReferralLetter/Acknowledge/" + appr_id + " <br>Thanks!"; SendEmailController email = new SendEmailController(); email.SendReferrer(ref_email, cc_email, body); } } } catch (Exception) { throw; } } public ActionResult Acknowledge(int appr_id = 0) { var check = db.rms_emails.Where(s => s.appr_id == appr_id && s.email_date_ack == null && s.email_isactive == true).FirstOrDefault(); if (check != null) { ViewBag.email_id = check.email_id; ViewBag.appr_id = appr_id; return PartialView(); } return RedirectToAction("Denied"); }

当我尝试断开http://localhost:8119/ReferralLetter/Acknowledge/" + appr_id函数时,appr_id值为0。当我收到电子邮件时,它显示了这一行:Acknowledge

意味着那里有一个ID,但为什么在http://localhost:8119/ReferralLetter/Acknowledge/23函数中ID为0?

0 个答案:

没有答案