public ActionResult Create(Recommendation recommendation)
        {
            if (ModelState.IsValid)
            {
                db.Recommendations.Add(recommendation);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.CustomerCid = new SelectList(db.Customers, "CustomerId", "Username", recommendation.CustomerCid);
            return View(recommendation);
        }
        public ActionResult Recommending(Recommendation cModel)
        {
            Customer currentUser = (Customer)Session["currentUser"];
            int customerId = currentUser.CustomerId;
            cModel.CustomerAid = customerId;
            cModel.Isread = false;

            //cModel.CustomerBid
                //cModel.CustomerCid

            Customer checkB = db.Customers.Find(cModel.CustomerBid);
            Customer checkC = db.Customers.Find(cModel.CustomerCid);

            if(checkB == null){
                ViewBag.Message1 = "No such service provider";
                return View();
            }

            if (checkC == null)
            {
                ViewBag.Message2 = "No such user";
                return View();
            }

            db.Recommendations.Add(cModel);
            db.SaveChanges();

            ViewBag.Message = "Thank you for your recommendation.";

            return RedirectToAction("Index", "Home");
        }
 public ActionResult Edit(Recommendation recommendation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(recommendation).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.CustomerCid = new SelectList(db.Customers, "CustomerId", "Username", recommendation.CustomerCid);
     return View(recommendation);
 }