Пример #1
0
        public ActionResult NewRating(RatingModel ratingModel)
        {
            string val1 = System.Web.HttpContext.Current.User.Identity.Name;
            int userId = Int32.Parse(val1);
            ratingModel.UserId = userId;
            ratingModel.add();

            var model = new RestroomModel();
            var viewModel = model.getRestroomWithRating(ratingModel.RestroomId);


            return RedirectToAction("Show", "Restroom", new { id = viewModel.restroomModel.id });
        }
Пример #2
0
 public static RatingListModel getLatestRatings()
 {
     var ratingList = new RatingListModel();
     using (var db = new shamethethronesContext())
     {
         var ratings = db.Ratings.Take(50).OrderByDescending(e => e.id).ToList();
         foreach(var rating in ratings)
         {
             var ratingModel = new RatingModel(rating);
             ratingList.add(ratingModel);
         }
     }
     return ratingList;
 }
Пример #3
0
 public void add(RatingModel rating)
 {
     this.ratings.Add(rating);
 }
Пример #4
0
 public ActionResult Rate(int id)
 {
     RatingModel rating = new RatingModel();
     rating.RestroomId = id;
     return View(rating);
 }