public async Task Delete(string id) { int _id = int.Parse(id); Submission item = await _context.Submissions.FindAsync(_id); if (item != null) { SubmissionProvider res = new SubmissionProvider(_workspace, _context, item); Directory.Delete(res.GetRoot(), true); _context.Submissions.Remove(item); await _context.SaveChangesAsync(); } }
public async Task <ISubmissionProvider> Create(SubmissionMetadata metadata) { Submission empty = new Submission(); _context.Submissions.Add(empty); await _context.SaveChangesAsync(); SubmissionProvider res = new SubmissionProvider(_workspace, _context, empty); Directory.CreateDirectory(res.GetRoot()); await res.SetMetadata(metadata); return(res); }