コード例 #1
0
        public void UpdateData(mstBook data)
        {
            var uow = new DapperUnitofWork();

            try
            {
                uow.OpenSQLConnection(dbConn);
                uow.BeginTransaction();

                var repo = new mstBookRepository(uow);
                repo.Update(data);

                uow.CommitTransaction();
            }
            catch (Exception)
            {
                uow.RollbackTransaction();
                throw;
            }
        }
コード例 #2
0
        public void DeleteData(string bookID)
        {
            var uow      = new DapperUnitofWork();
            var dataBook = new mstBook();

            try
            {
                uow.OpenSQLConnection(dbConn);
                uow.BeginTransaction();

                var repo = new mstBookRepository(uow);
                dataBook.SerialNo = bookID;
                repo.Delete(dataBook);

                uow.CommitTransaction();
            }
            catch (Exception)
            {
                uow.RollbackTransaction();
                throw;
            }
        }
コード例 #3
0
        public List <mstBook> ReadData(mstBook parameter)
        {
            var            uow      = new DapperUnitofWork();
            List <mstBook> listData = new List <mstBook>();

            try
            {
                uow.OpenSQLConnection(dbConn);

                var repo = new mstBookRepository(uow);

                listData = repo.ReadByFilter(x => x.Description.Contains(parameter.Description)).ToList();

                return(listData);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                uow.Dispose();
            }
        }