Example #1
0
        public JsonResult Subscribe(Vm_Index result)
        {
            if (result.SubscribeVM.Email == null)
            {
                return(Json("Failed"));
            }
            else
            {
                var q = db.Rep_Subscribe.Get(x => x.Email == result.SubscribeVM.Email).Select(x => x.Id).Count();
                if (q != 0)
                {
                    return(Json("Exist"));
                }
                else
                {
                    try
                    {
                        Tbl_Subscribe tbl = new Tbl_Subscribe();
                        tbl.Email            = result.SubscribeVM.Email.Trim();
                        tbl.CreationDateTime = DateTime.Now;
                        tbl.IsActive         = true;
                        db.Rep_Subscribe.Insert(tbl);
                        db.Rep_Subscribe.Save();

                        return(Json("Success"));
                    }
                    catch (Exception ex)
                    {
                        return(Json("Exeption : " + ex.Message));
                    }
                }
            }
        }
Example #2
0
        public JsonResult ContactUs(Vm_Index result)
        {
            if (result.CountactUsVM.Name == null ||
                result.CountactUsVM.Subject == null ||
                result.CountactUsVM.Massage == null ||
                result.CountactUsVM.Email == null)
            {
                return(Json("Failed"));
            }
            else
            {
                try
                {
                    Tbl_ContactUS tbl = new Tbl_ContactUS();
                    tbl.Name             = result.CountactUsVM.Name.Trim();
                    tbl.Email            = result.CountactUsVM.Email.Trim();
                    tbl.IsActive         = true;
                    tbl.Subject          = result.CountactUsVM.Subject.Trim();
                    tbl.Massage          = result.CountactUsVM.Massage.Trim();
                    tbl.CreationDateTime = DateTime.Now;
                    db.Rep_ContactUS.Insert(tbl);
                    db.Rep_ContactUS.Save();

                    return(Json("Success"));
                }
                catch (Exception ex)
                {
                    return(Json("Exeption: " + ex.Message));
                }
            }
        }