[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();
     }
 }
예제 #3
0
 public void ClearDb()
 {
     using (var context = new scriberContext(options))
     {
         // clear the db
         context.Tasks.RemoveRange(context.Tasks);
         context.SaveChanges();
     };
 }
예제 #4
0
 public void SetupDb()
 {
     using (var context = new scriberContext(options))
     {
         // populate the db
         context.Tasks.Add(datavalues[0]);
         context.Tasks.Add(datavalues[1]);
         context.SaveChanges();
     }
 }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
 public void Save()
 {
     context.SaveChanges();
 }