[TestCleanup] //for independence of unit tests, clear db after tests complete public void ClearDb() { using (var context = new scriberContext(options)) { context.Transcription.RemoveRange(context.Transcription); context.SaveChanges(); } }
public void SetupDb() { using (var context = new scriberContext(options)) { context.Transcription.Add(transciptions[0]); context.Transcription.Add(transciptions[0]); context.SaveChanges(); } }
public void ClearDb() { using (var context = new scriberContext(options)) { // clear the db context.Tasks.RemoveRange(context.Tasks); context.SaveChanges(); }; }
public void SetupDb() { using (var context = new scriberContext(options)) { // populate the db context.Tasks.Add(datavalues[0]); context.Tasks.Add(datavalues[1]); context.SaveChanges(); } }
public VideoDTO Patch(int id, [FromBody] JsonPatchDocument <VideoDTO> videoPatch) { Video originVideo = videoRepository.GetVideoById(id); VideoDTO videoDTO = _mapper.Map <VideoDTO>(originVideo); videoPatch.ApplyTo(videoDTO); _mapper.Map(videoDTO, originVideo); _context.Update(originVideo); _context.SaveChanges(); return(videoDTO); }
public VideoDTO Patch(int id, [FromBody] JsonPatchDocument <VideoDTO> videoPatch) { //get original video object from the database Video originVideo = videoRepository.GetVideoByID(id); //use automapper to map that to DTO object VideoDTO videoDTO = _mapper.Map <VideoDTO>(originVideo); //apply the patch to that DTO videoPatch.ApplyTo(videoDTO); //use automapper to map the DTO back ontop of the database object _mapper.Map(videoDTO, originVideo); //update video in the database _context.Update(originVideo); _context.SaveChanges(); return(videoDTO); }
public void Save() { context.SaveChanges(); }