Exemplo n.º 1
0
 public RatingModel(Rating r)
 {
     this.userID = r.User_ID;
     this.routeID = r.Route_ID;
     this.like = r.Rate;
 }
Exemplo n.º 2
0
        public static void insertRating(RatingModel rm)
        {
            // Check if rating for the user already exists
            Rating rating = (from r in _db.Ratings
                             where r.User_ID == rm.userID
                             && r.Route_ID == rm.routeID
                             select r).SingleOrDefault();

            // None exists
            if (rating == null)
            {
                rating = new Rating();
                rating.User_ID = rm.userID;
                rating.Route_ID = rm.routeID;
                rating.Rate = rm.like;
                _db.Ratings.InsertOnSubmit(rating);
            }
            else
            {
                rating.Rate = rm.like;
            }

            _db.SubmitChanges();
        }
Exemplo n.º 3
0
 partial void DeleteRating(Rating instance);
Exemplo n.º 4
0
 partial void UpdateRating(Rating instance);
Exemplo n.º 5
0
 partial void InsertRating(Rating instance);
Exemplo n.º 6
0
		private void detach_Ratings(Rating entity)
		{
			this.SendPropertyChanging();
			entity.User = null;
		}
Exemplo n.º 7
0
		private void attach_Ratings(Rating entity)
		{
			this.SendPropertyChanging();
			entity.User = this;
		}