コード例 #1
0
        public static ModelLibrary.Customer ConvertCustomerToModel(DatabaseAccessLibrary.Customer customer)
        {
            if (customer == null)
            {
                return(null);
            }

            var mCus = new ModelLibrary.Customer
            {
                Address = customer.address,
                Email   = customer.email,
                Id      = customer.id,
                Name    = customer.name,
                RoleId  = customer.roleId,
                PhoneNo = customer.phoneNo.ToString()
            };

            return(mCus);
        }
コード例 #2
0
        public static DatabaseAccessLibrary.Customer ConvertCustomerToDatabase(ModelLibrary.Customer mCus)
        {
            if (mCus == null)
            {
                return(null);
            }

            var customer = new DatabaseAccessLibrary.Customer
            {
                address = mCus.Address,
                email   = mCus.Email,
                id      = mCus.Id,
                name    = mCus.Name,
                roleId  = mCus.RoleId,
            };

            Int32.TryParse(mCus.PhoneNo, out int no);
            customer.phoneNo = no;

            return(customer);
        }