public ActionResult DeleteConfirmed(int id)
        {
            AnalyticsMetric analyticsmetric = db.AnalyticsMetrics.Find(id);

            db.AnalyticsMetrics.Remove(analyticsmetric);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit(AnalyticsMetric analyticsmetric)
 {
     if (ModelState.IsValid)
     {
         db.Entry(analyticsmetric).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(analyticsmetric));
 }
        public ActionResult Create(AnalyticsMetric analyticsmetric)
        {
            if (ModelState.IsValid)
            {
                db.AnalyticsMetrics.Add(analyticsmetric);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(analyticsmetric));
        }
        public ActionResult Result(int id = 0)
        {
            AnalyticsMetric analyticsmetric = db.AnalyticsMetrics.Find(id);

            if (analyticsmetric == null)
            {
                return(HttpNotFound());
            }
            string keyword = db.Keywords.Where(r => r.type == analyticsmetric.type).Select(r => r.name).Single().ToString();

            ViewBag.keyword = keyword;

            return(View(db.SearchLogs.Where(a => a.keywordType == analyticsmetric.type).OrderByDescending(a => a.searchDate).ToList()));
        }
        //
        // GET: /AnalyticsMetricsMgmt/Details/5

        public ActionResult Details(int id = 0)
        {
            AnalyticsMetric analyticsmetric = db.AnalyticsMetrics.Find(id);

            if (analyticsmetric == null)
            {
                return(HttpNotFound());
            }
            string keyword = db.Keywords.Where(r => r.type == analyticsmetric.type).Select(r => r.name).Single().ToString();

            ViewBag.keyword = keyword;

            return(View(analyticsmetric));
        }