/// <summary> /// Creates a Kirja Page Version /// </summary> /// <param name="pageVersion">Page version to create</param> /// <returns>Created page, with filled id</returns> public async Task <KirjaPageVersion> CreatePageVersion(KirjaPageVersion pageVersion) { pageVersion.Id = Guid.NewGuid().ToString(); await _PageVersionCollection.InsertOneAsync(pageVersion); return(pageVersion); }
/// <summary> /// Deletes a page version /// </summary> /// <param name="pageVersion">Page version to delete</param> /// <returns>Task</returns> public async Task DeletePageVersion(KirjaPageVersion pageVersion) { DeleteResult result = await _PageVersionCollection.DeleteOneAsync(p => p.Id == pageVersion.Id); }
/// <summary> /// Update a page version /// </summary> /// <param name="pageVersion">Page version to update</param> /// <returns>Task</returns> public async Task UpdatePageVersion(KirjaPageVersion pageVersion) { ReplaceOneResult result = await _PageVersionCollection.ReplaceOneAsync(p => p.Id == pageVersion.Id, pageVersion); }
/// <summary> /// Returns a page version by its id /// </summary> /// <param name="id">Id</param> /// <returns>Page Version</returns> public async Task <KirjaPageVersion> GetPageVersionById(string id) { KirjaPageVersion pageVersion = await _PageVersionCollection.Find(p => p.Id == id).FirstOrDefaultAsync(); return(pageVersion); }