public ActionResult ContactUs()
        {
            //if logged in user's userrole is not member then redirect to admin dashboard
            if (User.Identity.IsAuthenticated)
            {
                var user = dobj.Users.Where(x => x.EmailID == User.Identity.Name).FirstOrDefault();
                if (user.RoleID != dobj.UserRole.Where(x => x.Name.ToLower() == "member").Select(x => x.ID).FirstOrDefault())
                {
                    return(RedirectToAction("Dashboard", "Admin"));
                }
            }
            // viewbag for active class in navigation
            ViewBag.Contactus = "active";
            // check if user is authenticated then we need to show full name and email
            if (User.Identity.IsAuthenticated)
            {
                // if user is authenticated then get user
                var user = dobj.Users.Where(x => x.EmailID == User.Identity.Name).FirstOrDefault();
                // create contact us viewmodel
                Models.ContactUs viewmodel = new Models.ContactUs();

                viewmodel.FullName = user.FirstName + " " + user.LastName;
                viewmodel.EmailID  = user.EmailID;
                // return viewmodel
                return(View(viewmodel));
            }
            else
            {
                return(View());
            }
        }
 public async Task <ActionResult> Contact(Models.ContactUs contactUs)
 {
     if (ModelState.IsValid)
     {
         await InsertContactUs(contactUs);
     }
     return(await Contact());
 }
        public override System.Web.Mvc.ActionResult Edit(Models.ContactUs contactUs)
        {
            var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Edit);

            ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "contactUs", contactUs);
            EditOverride(callInfo, contactUs);
            return(callInfo);
        }
Пример #4
0
 public IHttpActionResult UpdateContactUs([FromBody] Models.ContactUs content)
 {
     if (content == null)
     {
         return(BadRequest("The parameters are missing."));
     }
     _dao.InsertContactUd(content);
     return(Ok());
 }
        protected async Task InsertContactUs(Models.ContactUs contactUs)
        {
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(GetBaseURL());
                HttpResponseMessage response = await client.PostAsJsonAsync("contactUs", contactUs);

                response.EnsureSuccessStatusCode();
            }
        }
Пример #6
0
        public ActionResult show(ViewModel cu)
        {
            int id = cu.Id;

            Models.ContactUs contactUs = db.ContactUs.Find(id);
            contactUs.UserName = cu.UserName;
            contactUs.Email    = cu.Email;
            contactUs.Subject  = cu.Subject;
            contactUs.PM       = cu.PM;
            contactUs.Status   = 1;
            db.SaveChanges();
            ModelState.Clear();
            return(RedirectToAction("ContactPM"));
        }
Пример #7
0
        public virtual System.Web.Mvc.ActionResult DeleteConfirmed(System.Guid id)
        {
            Models.ContactUs oContactUs =
                UnitOfWork.ContactUsRepository.Get()
                .Where(current => current.Id == id)
                .FirstOrDefault()
            ;

            UnitOfWork.ContactUsRepository.Delete(oContactUs);

            UnitOfWork.Save();

            return(RedirectToAction(MVC.ContactUs.AdminIndex()));
        }
Пример #8
0
        public virtual System.Web.Mvc.ActionResult Details(System.Guid id)
        {
            Models.ContactUs oContactUs =
                UnitOfWork.ContactUsRepository.Get()
                .Where(current => current.Id == id)
                .FirstOrDefault()
            ;

            if (oContactUs == null)
            {
                return(HttpNotFound());
            }

            return(View(oContactUs));
        }
Пример #9
0
        public virtual System.Web.Mvc.ActionResult Edit(Models.ContactUs contactUs)
        {
            contactUs.UpdateDateTime = Infrastructure.Utility.Now;

            if (ModelState.IsValid)
            {
                UnitOfWork.ContactUsRepository.Update(contactUs);

                UnitOfWork.Save();

                return(RedirectToAction(MVC.ContactUs.Index()));
            }

            return(View(contactUs));
        }
Пример #10
0
        public virtual System.Web.Mvc.ActionResult Create(Models.ContactUs contactUs)
        {
            if (ModelState.IsValid)
            {
                UnitOfWork.ContactUsRepository.Insert(contactUs);

                UnitOfWork.Save();



                return(View(contactUs));
            }

            return(View(contactUs));
        }
Пример #11
0
        public virtual System.Web.Mvc.ActionResult Index(Models.ContactUs contactUs)
        {
            if (ModelState.IsValid)
            {
                UnitOfWork.ContactUsRepository.Insert(contactUs);
                ViewBag.message = Models.Resources.ContactUs.SaveMessage;
                UnitOfWork.Save();

                System.Net.Mail.MailMessage msg  = new System.Net.Mail.MailMessage();
                System.Net.Mail.MailAddress from = new System.Net.Mail.MailAddress("*****@*****.**", "کاربر", System.Text.Encoding.UTF8);
                System.Net.Mail.MailAddress to   = new System.Net.Mail.MailAddress("*****@*****.**", "وب سایت رسمی ناصر فروتن", System.Text.Encoding.UTF8);

                msg.Subject         = contactUs.Name + " " + contactUs.LastName;
                msg.SubjectEncoding = System.Text.Encoding.UTF8;
                //msg.Body = contactUs.Name + "  " + contactUs.LastName + "\n\r" + Resources.ContactUs.City + ": " + contactUs.City + "\n\r" + Resources.ContactUs.Mobile + ": " +
                //           contactUs.Mobile + "\n\r" + Resources.ContactUs.Message + ":" + contactUs.Message;
                msg.Body         = "test tetete";
                msg.BodyEncoding = System.Text.Encoding.UTF8;
                msg.From         = from;
                msg.To.Add(to);


                System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();
                //  smtp.Host = "smtp.mail.yahoo.com";
                //  "mail.pap-ict.ir";
                smtp.Host        = "smtp.gmail.com";
                smtp.Port        = 587;
                smtp.Timeout     = 36000;
                smtp.EnableSsl   = false;
                smtp.Credentials = new NetworkCredential("*****@*****.**", "naserforoutan1397");
                smtp.Send(msg);

                var IsDisabled = true;
                ViewBag.IsDisabled = IsDisabled;
                ModelState.Clear();
            }

            else
            {
                ViewBag.Error = Resources.Messages.Captcha;
                var IsDisabled = false;
                ViewBag.IsDisabled = IsDisabled;
            }
            return(View());
        }
        public ActionResult ContactUs(Models.ContactUs model)
        {
            if (ModelState.IsValid)
            {
                Context.ContactUs obj = new Context.ContactUs();
                obj.FullName = model.FullName;
                obj.EmailID  = model.EmailID;
                obj.Subjects = model.Subjects;
                obj.Comments = model.Comments;

                dobj.ContactUs.Add(obj);
                SendEmailToAdmin(obj);
                dobj.SaveChanges();
                ModelState.Clear();
                return(RedirectToAction("ContactUs"));
            }
            else
            {
                return(View(model));
            }
        }
 public void InsertContactUd(Models.ContactUs contactUs) =>
 base.ExecQuery(QUERY_INSERT_CONTACT_US, contactUs);
 partial void EditOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, Models.ContactUs contactUs);