Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…Server into dev
  • Loading branch information
meofiscoding committed Nov 26, 2023
2 parents ed7a5a6 + 2faf45f commit 00ce0f9
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,14 @@ public async Task<List<List<MovieInformation>>> GetAllMoviesByCategoryAsync(Cate
return result;
}

public Task UpsertMovieAsync(MovieInformation movie)
public async Task UpsertMovieAsync(MovieInformation movie)
{
// filter by name
var filter = Builders<MovieInformation>.Filter.Eq(movie.MovieName, movie.MovieName);
return _context.Movies.ReplaceOneAsync(filter, movie, new ReplaceOptions { IsUpsert = true });
//// filter by name
//var filter = Builders<MovieInformation>.Filter.Eq(movie.MovieName, movie.MovieName);
//return _context.Movies.ReplaceOneAsync(filter, movie, new ReplaceOptions { IsUpsert = true });
movie.Id ??= ObjectId.GenerateNewId().ToString();
var filter = Builders<MovieInformation>.Filter.Eq(x => x.Id, movie.Id);
await _context.Movies.ReplaceOneAsync(filter, movie, new ReplaceOptions { IsUpsert = true });
}

public Dictionary<int, string> GetAllCategories()
Expand Down

0 comments on commit 00ce0f9

Please sign in to comment.