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

            return View(restaraunt);
        }
예제 #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);
        }
예제 #3
0
 public RestarauntRater(Restaraunt data)
 {
     // TODO: Complete member initialization
     this.data = data;
 }
예제 #4
0
 public ActionResult Edit(Restaraunt restaraunt)
 {
     if (ModelState.IsValid)
     {
         db.Entry(restaraunt).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(restaraunt);
 }