public IHttpActionResult GetResetPasswordWithID([FromUri] int ResetPasswordID, [FromUri] string lang = "en", [FromUri] string extra = "")
        {
            using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
            {
                ResetPasswordService resetPasswordService = new ResetPasswordService(new Query()
                {
                    Language = (lang == "fr" ? LanguageEnum.fr : LanguageEnum.en)
                }, db, ContactID);

                resetPasswordService.Query = resetPasswordService.FillQuery(typeof(ResetPassword), lang, 0, 1, "", "", extra);

                if (resetPasswordService.Query.Extra == "A")
                {
                    ResetPasswordExtraA resetPasswordExtraA = new ResetPasswordExtraA();
                    resetPasswordExtraA = resetPasswordService.GetResetPasswordExtraAWithResetPasswordID(ResetPasswordID);

                    if (resetPasswordExtraA == null)
                    {
                        return(NotFound());
                    }

                    return(Ok(resetPasswordExtraA));
                }
                else if (resetPasswordService.Query.Extra == "B")
                {
                    ResetPasswordExtraB resetPasswordExtraB = new ResetPasswordExtraB();
                    resetPasswordExtraB = resetPasswordService.GetResetPasswordExtraBWithResetPasswordID(ResetPasswordID);

                    if (resetPasswordExtraB == null)
                    {
                        return(NotFound());
                    }

                    return(Ok(resetPasswordExtraB));
                }
                else
                {
                    ResetPassword resetPassword = new ResetPassword();
                    resetPassword = resetPasswordService.GetResetPasswordWithResetPasswordID(ResetPasswordID);

                    if (resetPassword == null)
                    {
                        return(NotFound());
                    }

                    return(Ok(resetPassword));
                }
            }
        }
예제 #2
0
 public ResetPasswordTest()
 {
     resetPassword       = new ResetPassword();
     resetPasswordExtraA = new ResetPasswordExtraA();
     resetPasswordExtraB = new ResetPasswordExtraB();
 }