コード例 #1
0
        public JsonResult SubscribeEmail(string Email)
        {
            bool IsExist = _SubscribeService.IsSubscribedEmail(Email);

            if (!IsExist)
            {
                bool IsSuccess = _SubscribeService.SubscribeEmail(Email);
                if (IsSuccess)
                {
                    return(Json(new { Code = 1, Message = "Your email has been subscribed successfully!" }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { Code = 0, Message = "Something wrong! Try after some time!" }, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(new { Code = 0, Message = "You have already subscribed this email!" }, JsonRequestBehavior.AllowGet));
            }
        }