public async Task <bool> UpdateAsync(DTO.Actor entity) { //var dbEntity = _mapper.Map<IMDBScraper.DAL.DBEntity.Actor>(entity); var filter = Builders <DBEntity.Actor> .Filter.Eq(s => s.Name, entity.Name); var actor = await ActorsContext.Find <DBEntity.Actor>(filter).FirstOrDefaultAsync(); actor.Birthday = entity.Birthday; actor.Roles = entity.Roles; actor.ImageURL = entity.ImageURL; ReplaceOneResult updateResult = await ActorsContext .ReplaceOneAsync( filter : filter, replacement : actor); return(updateResult.IsAcknowledged && updateResult.ModifiedCount > 0); }
public async Task InsertAsync(DTO.Actor entity) { var dbEntity = _mapper.Map <IMDBScraper.DAL.DBEntity.Actor>(entity); await ActorsContext.InsertOneAsync(dbEntity); }
public async Task <bool> DeleteAsync(DTO.Actor entityToDelete) { return(await DeleteAsync(entityToDelete.Id)); }