示例#1
0
        public int AddFolder(NewFolderViewModel model, string userId)
        {
            var folder = Mapper.Map <Folder>(model);

            folder.UserId = userId;
            _context.Folders.Add(folder);
            _context.SaveChanges();
            return(folder.Id);
        }
示例#2
0
        public int AddFile(NewFileViewModel model, string userId, int?id)
        {
            var file = Mapper.Map <File>(model);

            file.UserId         = userId;
            file.ParentFolderId = id;
            _context.Files.Add(file);
            _context.SaveChanges();
            return(file.Id);
        }