public ActionResult Create(Restaraunt restaraunt)
        {
            if (ModelState.IsValid)
            {
                db.Restaraunts.Add(restaraunt);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(restaraunt);
        }
Esempio n. 2
0
        public void TestMethod1()
        {
            var data = new Restaraunt();
            data.Reviews = new List<RestarauntReview>();
            data.Reviews.Add(new RestarauntReview() { Rating = 4 });

            var rater = new RestarauntRater(data);
            var result = rater.ComputeRating(10);

            Assert.AreEqual(4, result.Rating);
        }
Esempio n. 3
0
 public RestarauntRater(Restaraunt data)
 {
     // TODO: Complete member initialization
     this.data = data;
 }
 public ActionResult Edit(Restaraunt restaraunt)
 {
     if (ModelState.IsValid)
     {
         db.Entry(restaraunt).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(restaraunt);
 }