Example #1
0
        public ActionResult KirimToken(token getDate)
        {
            long waktuToken    = getDate.dateToken.Date.Ticks;
            long waktuSekarang = DateTime.Now.Date.Ticks;

            //Random randomNumber = new Random();
            //long getRandomNumber = randomNumber.Next(1, 1000000000);
            //char forRandomString ;
            //StringBuilder getRandomString= new StringBuilder();
            //string finalRandomString = "";
            //for (int i = 0; i < 26; i++)
            //{
            //    forRandomString = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * randomNumber.NextDouble() + 65)));
            //    getRandomString.Append(forRandomString);
            //}
            //finalRandomString = getRandomString.ToString();

            if (waktuToken < waktuSekarang)
            {
                return(Json(new { status = "failed" }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                try
                {
                    KirimTokenRepo kirimSekarang = new KirimTokenRepo();
                    if (kirimSekarang.GetAll(getDate))
                    {
                        return(Json(new { status = "berhasil" }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json(new { status = "gagal_kirim_email" }, JsonRequestBehavior.AllowGet));
                    }
                }
                catch (Exception)
                {
                    return(Json(new { status = "gagal_kirim_email" }, JsonRequestBehavior.AllowGet));
                }
            }
        }
Example #2
0
 public ActionResult Tampil(int ID)
 {
     return(Json(KirimTokenRepo.GetAll(ID), JsonRequestBehavior.AllowGet));
 }