예제 #1
0
        public void DeleteFile(int id)
        {
            var file = _contextProvider.Context.File.Where(x => x.Id == id).FirstOrDefault();
            var fileContext = new FileUploadDbContext();
            fileContext.File.Attach((file));
            fileContext.Entry(file).State = System.Data.Entity.EntityState.Deleted;

            fileContext.SaveChanges();
        }
예제 #2
0
        public void EditFile(Protiviti.Boilerplate.Server.Api.FileUpload.Entity.File editedFile)
        {
            var file = _contextProvider.Context.File.Where(x => x.Id == editedFile.Id).FirstOrDefault();

            file.FileName = editedFile.FileName;
            file.Title = editedFile.Title;

            var fileContext = new FileUploadDbContext();
            fileContext.File.Attach((file));
            fileContext.Entry(file).State = System.Data.Entity.EntityState.Modified;

            fileContext.SaveChanges();
        }