コード例 #1
0
 public RatingModel(Rating rating)
 {
     this.RestroomId = rating.restroomId;
     this.Comment = rating.comment;
     this.Rating = rating.ratingValue;
     this.Title = rating.title;
     this.UserId = rating.userId;
 }
コード例 #2
0
        public int UserId; // later on will be required

        public void add()
        {
            using (var db = new shamethethronesContext())
            {
                var rating = new Rating();
                rating.userId = this.UserId;
                rating.comment = this.Comment;
                rating.restroomId = this.RestroomId;
                rating.title = this.Title;
                rating.ratingValue = (byte) this.Rating;
                db.Ratings.Add(rating);
                db.SaveChanges();
            }
        }