public TvShowComment Add(string content, int showId, string userId) { if (string.IsNullOrWhiteSpace(content) || string.IsNullOrWhiteSpace(userId)) { return(null); } var user = this.users.GetById(userId); if (user == null) { return(null); } var comment = new TvShowComment() { Content = content, TvShowId = showId, AuthorId = user.Id }; this.tvShowComments.Add(comment); this.tvShowComments.SaveChanges(); return(this.tvShowComments.GetById(comment.Id)); }
public TvShowComment Add(string content, int showId, string userId) { if (string.IsNullOrWhiteSpace(content) || string.IsNullOrWhiteSpace(userId)) { return null; } var user = this.users.GetById(userId); if (user == null) { return null; } var comment = new TvShowComment() { Content = content, TvShowId = showId, AuthorId = user.Id }; this.tvShowComments.Add(comment); this.tvShowComments.SaveChanges(); return this.tvShowComments.GetById(comment.Id); }