public static void Insert(PageViewModel target, DataOperationUnit dataOpUnit = null) { PageDao dao = new PageDao(); dao.Insert(target.ToEntity(), dataOpUnit?.CurrentConnection); s_logger.Debug($"INSERT Page:{target}"); }
private void ImportPage(ILibrary libManager, BookViewModel parent, PageViewModel page) { PageDao pageDao = new PageDao(); pageDao.Insert(page.ToEntity(), _dataOpUnit.CurrentConnection); libManager.AccessDispatcherObject(() => parent.AddPage(page)); }
public void UpdatePageIndexOnlyTest() { var id = new Guid("66F5EC93-FD2C-4DCC-A76B-5FE3D00C6E58"); var imageid = new Guid("83506829-1661-4329-8C43-8AE858F00F02"); var bookid = new Guid("9277ACAF-AB93-47B2-BE04-92566DE6F190"); var pageindex = int.MaxValue; var title = "Inserted page"; var page = new Page(); page.ID = id; page.ImageID = imageid; page.BookID = bookid; page.PageIndex = pageindex; page.Title = title; PageDao dao = new PageDao(); dao.Insert(page); var records = dao.FindBy(new Dictionary <string, object>() { { "ID", id } }); Assert.That(records.Count(), Is.EqualTo(1)); var record = records.Single(); Assert.That(record.ID, Is.EqualTo(id)); Assert.That(record.ImageID, Is.EqualTo(imageid)); Assert.That(record.BookID, Is.EqualTo(bookid)); Assert.That(record.PageIndex, Is.EqualTo(pageindex)); Assert.That(record.Title, Is.EqualTo(title)); //Change page.PageIndex = 1; dao.Update(page); records = dao.FindBy(new Dictionary <string, object>() { { "ID", id } }); Assert.That(records.Count(), Is.EqualTo(1)); record = records.Single(); Assert.That(record.ID, Is.EqualTo(id)); Assert.That(record.ImageID, Is.EqualTo(imageid)); Assert.That(record.BookID, Is.EqualTo(bookid)); Assert.That(record.PageIndex, Is.EqualTo(1)); Assert.That(record.Title, Is.EqualTo(title)); }