예제 #1
0
        public IHttpActionResult PostAccount_Holder(ForgotTranspassword forgotTransPassword)
        {
            if (forgotTransPassword.email_id == db.fetchemail(forgotTransPassword.account_no).FirstOrDefault())
            {
                int onetimepassword = random.Next(10000, 99999);
                db.insertotp(onetimepassword);
                SendOtpforTranspasssword(forgotTransPassword.email_id, onetimepassword);
                return(Ok("otp sent"));
            }
            else
            {
                return(Ok("not matched"));
            }
            //if (!ModelState.IsValid)
            //{
            //    return BadRequest(ModelState);
            //}

            //db.Account_Holder.Add(account_Holder);

            //try
            //{
            //    db.SaveChanges();
            //}
            //catch (DbUpdateException)
            //{
            //    if (Account_HolderExists(account_Holder.account_no))
            //    {
            //        return Conflict();
            //    }
            //    else
            //    {
            //        throw;
            //    }
            //}

            // return CreatedAtRoute("DefaultApi", new { id = account_Holder.account_no }, account_Holder);
        }
예제 #2
0
        public IHttpActionResult PostAccount_Holder1(ForgotTranspassword forgotTransPassword)
        {
            decimal?a = db.fetchtotp().FirstOrDefault();

            if (forgotTransPassword.otp == a)
            {
                SendTranspassword(forgotTransPassword.email_id, db.fetchtranspassword(forgotTransPassword.account_no).FirstOrDefault());
                return(Ok("success"));
            }
            else
            {
                return(Ok("fail"));
            }
            //if (!ModelState.IsValid)
            //{
            //    return BadRequest(ModelState);
            //}

            //db.Account_Holder.Add(account_Holder);

            //try
            //{
            //    db.SaveChanges();
            //}
            //catch (DbUpdateException)
            //{
            //    if (Account_HolderExists(account_Holder.account_no))
            //    {
            //        return Conflict();
            //    }
            //    else
            //    {
            //        throw;
            //    }
            //}

            //return CreatedAtRoute("DefaultApi", new { id = account_Holder.account_no }, account_Holder);
        }