public RatingModel(Rating rating) { this.RestroomId = rating.restroomId; this.Comment = rating.comment; this.Rating = rating.ratingValue; this.Title = rating.title; this.UserId = rating.userId; }
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(); } }