async public Task<IActionResult> UpdateFolder([FromBody] ghostlight.Shared.Folder model, string folderId) { var folder = await _db.Folders.FirstOrDefaultAsync(o => o.Id == folderId); folder.Name = model.Name; await _db.SaveChangesAsync(); return Ok(folder.ToSharedFolder()); }
async public Task<IActionResult> CreateFolder([FromBody] ghostlight.Shared.Folder model) { string userEmail = User.GetUserEmail(); Entities.Folder folder = new Entities.Folder() { Name = model.Name, AuthorizedUsers = new List<Entities.AuthorizedUser>() { new Entities.AuthorizedUser() { Email = userEmail, Administrator = true, Write = true, Read = true, Delete = true } } }; _db.Folders.Add(folder); await _db.SaveChangesAsync(); return Ok(folder.ToSharedFolder()); }