public RatingModel(Rating r) { this.userID = r.User_ID; this.routeID = r.Route_ID; this.like = r.Rate; }
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(); }
partial void DeleteRating(Rating instance);
partial void UpdateRating(Rating instance);
partial void InsertRating(Rating instance);
private void detach_Ratings(Rating entity) { this.SendPropertyChanging(); entity.User = null; }
private void attach_Ratings(Rating entity) { this.SendPropertyChanging(); entity.User = this; }