Example #1
0
        public ActionResult Contact(tblFeedbackEntry tblFeedbackEntry)
        {
            if (ModelState.IsValid)
            {
                tblFeedbackEntry.DateTime = DateTime.Now;

                db.tblFeedbackEntries.Add(tblFeedbackEntry);
                db.SaveChanges();

                TempData["FeedbackEntrySuccessful"] = true;
                return(RedirectToAction("Index"));
            }

            return(View(tblFeedbackEntry));
        }
Example #2
0
 /// <summary>
 /// Get Contact/Feedback page
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ActionResult Contact(object id)
 {
     if (User.Identity.Name != "")
     {
         tblUser tblUser = db.tblUsers.Where(x => x.Username.Equals(User.Identity.Name)).First();
         if (tblUser != null)
         {
             tblFeedbackEntry tblFeedbackEntry = new tblFeedbackEntry()
             {
                 Username = tblUser.Username, EmailAddress = tblUser.EmailAddress
             };
             return(View(tblFeedbackEntry));
         }
     }
     return(View());
 }