Exemplo n.º 1
0
        private void SetAuthorTo(IAuthorManager authorManager, BookViewModel add)
        {
            IDConversionDao idcDao    = new IDConversionDao();
            AuthorDao       authorDao = new AuthorDao();
            var             idc       = idcDao.FindBy(new Dictionary <string, object>()
            {
                { "TableName", "Author" }, { "ForeignID", add.AuthorID }
            }, _dataOpUnit.CurrentConnection);

            if (idc.Count() == 1)
            {
                add.Author = authorDao.FindBy(new Dictionary <string, object>()
                {
                    { "ID", idc.Single().DomesticID }
                }, _dataOpUnit.CurrentConnection).SingleOrDefault().ToViewModel();
            }
            else
            {
                add.Author = authorDao.FindBy(new Dictionary <string, object>()
                {
                    { "ID", add.AuthorID }
                }, _dataOpUnit.CurrentConnection).SingleOrDefault().ToViewModel();
            }
            authorManager.ObserveAuthorCount();
        }
Exemplo n.º 2
0
        public static IEnumerable <Author> FindBy(string name, DataOperationUnit dataOpUnit = null)
        {
            AuthorDao dao = new AuthorDao();

            return(dao.FindBy(new Dictionary <string, object>()
            {
                { "Name", name }
            }, dataOpUnit?.CurrentConnection));
        }
Exemplo n.º 3
0
        public static AuthorViewModel FindBy(Guid id, DataOperationUnit dataOpUnit = null)
        {
            AuthorDao dao = new AuthorDao();

            return(dao.FindBy(new Dictionary <string, object>()
            {
                { "ID", id }
            }, dataOpUnit?.CurrentConnection).SingleOrDefault().ToViewModel());
        }