Exemple #1
0
        public ActionResult Customers(SurveyCustomerViewModel scv)
        {
            for (int i = 0; i < scv.Customers.Count(); i++)
            {
                if (scv.isSelected[i])
                {
                    Customer customer  = db.Customers.Find(scv.Customers[i].Id);
                    Survey   survey    = db.Surveys.Find(scv.SurveyID);
                    string   custEmail = customer.Email;


                    EmailGeneration.SendEmail(custEmail, "Customers/Survey/" + survey.Id.ToString());
                }
            }

            return(View("Success"));
        }
Exemple #2
0
        //GET Surveys/Customers/SurveyID
        //This view will show the list of customers after an admin clicks on Send from the survey page
        public ActionResult Customers(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Survey survey = db.Surveys.Find(id);

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

            SurveyCustomerViewModel scv = new SurveyCustomerViewModel()
            {
                SurveyID   = survey.Id,
                SurveyName = survey.SurveyTitle,
                Customers  = db.Customers.ToList()
            };

            //This should return the Customer model with a list of customers
            return(View(scv));
        }