public ActionResult DeleteConfirmed(int id)
        {
            CompanyComment companyComment = db.CompanyComments.Find(id);

            db.CompanyComments.Remove(companyComment);
            db.SaveChanges();
            return(RedirectToAction("Details", "Manage"));
        }
 public ActionResult Edit([Bind(Include = "CommentId,Comments,ThisDateTime,CompanyId,Rating")] CompanyComment companyComment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(companyComment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Details", "Manage"));
     }
     return(View(companyComment));
 }
        public ActionResult Create([Bind(Include = "CommentId,Comments,ThisDateTime,CompanyId,Rating")] CompanyComment articlesComment)
        {
            if (ModelState.IsValid)
            {
                db.CompanyComments.Add(articlesComment);
                db.SaveChanges();
                return(RedirectToAction("Details", "Manage"));
            }

            return(View(articlesComment));
        }
        // GET: CompanyComments/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CompanyComment companyComment = db.CompanyComments.Find(id);

            if (companyComment == null)
            {
                return(HttpNotFound());
            }
            return(View(companyComment));
        }
        public ActionResult Add(FormCollection form)
        {
            var comment   = form["Comment"].ToString();
            var companyId = int.Parse(form["CompanyId"]);
            var rating    = int.Parse(form["Rating"]);

            CompanyComment compComment = new CompanyComment()
            {
                CompanyId    = companyId,
                Comments     = comment,
                Rating       = rating,
                ThisDateTime = DateTime.Now
            };

            db.CompanyComments.Add(compComment);
            db.SaveChanges();

            return(RedirectToAction("Details", "Manage", new { id = companyId }));
        }