public RatingAPIViewModel CreateRatingProduct(RatingAPIViewModel rating) { var RatingProductE = rating.ToEntity(); RatingProductE.UserId = null; this.Create(RatingProductE); return(new RatingAPIViewModel(RatingProductE)); }
public RatingAPIViewModel UpdateRatingProduct(RatingAPIViewModel rating) { var ratingE = Repository.FirstOrDefault(c => c.Id == rating.Id); if (ratingE != null) { var ratingET = rating.ToEntity(); Repository.Edit(ratingET); Repository.Save(); rating = new RatingAPIViewModel(ratingET); return(rating); } return(null); }