Example #1
0
        public ActionResult IssuesJSON(string issue, string year, string make, string model, string page)
        {
            if (issue != null && year != null && make != null && model != null)
            {
                Data d = new Data();

                CarComments complaints = d.GetIssuesByComponent(page, issue, year, make, model);

                return Json(complaints, JsonRequestBehavior.AllowGet);
            }
            return null;
        }
Example #2
0
        // GET: Car/Details/5
        public ActionResult Issues(string issue, string year, string make, string model, string page)
        {
            if (issue != null && year != null && make != null && model != null)
            {
                Data d = new Data();

                int complaintCountTotal = d.GetComplaintCountTotal(issue, year, make, model);

                CarComments complaints = d.GetIssuesByComponent(page, issue, year, make, model);
                ViewBag.Complaints = complaints;

                ViewBag.Year = year;
                ViewBag.Make = make;
                ViewBag.Model = model;
                ViewBag.Issue = issue;
                ViewBag.Page = page;

                ViewBag.ComplaintCount = complaintCountTotal;

                ViewBag.Title = "WTF Car";
                ViewBag.Subtitle = year + " " + make + " " + model + " " + issue + " issues";

                ViewBag.MetaDescription = "The " + year + " " + make + " " + model + " has " + complaintCountTotal + " " + issue.ToLower() + " complaints.";
                ViewBag.MetaKeywords = year + "," + make + "," + model + "," + issue.ToLower() + ",complaints,wtf,car";

            }
            else
            {
                ViewBag.Year = "";
                ViewBag.Make = "";
                ViewBag.Model = "";

                ViewBag.Complaints = new CarComments();

                ViewBag.Title = "WTF Car";
                ViewBag.Subtitle = year + " " + make + " " + model + " " + " issues";

                ViewBag.MetaDescription = "The " + year + " " + make + " " + model + " " + issue.ToLower() + " complaints.";
                ViewBag.MetaKeywords = year + "," + make + "," + model + "," + ",complaints,wtf,car";
            }

            return View();
        }
Example #3
0
        public CarComments GetIssuesByComponent(string page, string issue, string year, string make, string model)
        {
            CarComments lComplaints = new CarComments();

            List <SqlParameter> lParams = new List <SqlParameter>();
            SqlParameter        m       = new SqlParameter("component", issue);

            lParams.Add(m);
            m = new SqlParameter("year", year);
            lParams.Add(m);
            m = new SqlParameter("make", make);
            lParams.Add(m);
            m = new SqlParameter("model", model);
            lParams.Add(m);
            if (!string.IsNullOrEmpty(page))
            {
                m = new SqlParameter("page", page);
                lParams.Add(m);
            }
            else
            {
                m = new SqlParameter("page", "1");
                lParams.Add(m);
            }


            DataTable dt = ExecuteStoredProcSQL("GetIssuesByComponent", true, lParams);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                CarComment cc = new CarComment
                {
                    CarCommentTitle = "Comment #" + i.ToString(),
                    CarCommentText  = dt.Rows[i][1].ToString()
                };
                lComplaints.CarCommentsList.Add(cc);
            }

            return(lComplaints);
        }