text: ﻿var ProductDetailController = function () {
      this.initialize = function () {
          registerEvents();
          registerEvents1();
      }
  
      function registerEvents() {
          $('#btnAddToCart').on('click', function (e) {
              e.preventDefault();
              var id = parseInt($(this).data('id'));
              var colorId = parseInt($('#ddlColorId').val());
              var sizeId = parseInt($('#ddlSizeId').val());
              $.ajax({
                  url: '/Cart/AddToCart',
                  type: 'post',
                  dataType: 'json',
                  data: {
                      productId: id,
                      quantity: parseInt($('#txtQuantity').val()),
                      color: colorId,
                      size: sizeId
                  },
                  success: function () {
                      /*tedu.notify('Product was added successful', 'success');*/
                      loadHeaderCart();
                  }
              });
          });
          
      }
      function registerEvents1() {
          $('#btnAddToCart1').on('click', function (e) {
              e.preventDefault();
              var id = parseInt($(this).data('id'));
              var colorId = parseInt($('#ddlColorId').val());
              var sizeId = parseInt($('#ddlSizeId').val());
              $.ajax({
                  url: '/Cart/AddToCart',
                  type: 'post',
                  dataType: 'json',
                  data: {
                      productId: id,
                      quantity: parseInt($('#txtQuantity').val()),
                      color: colorId,
                      size: sizeId
                  },
                  success: function () {
                      /*tedu.notify('Product was added successful', 'success');*/
                      loadHeaderCart();
                  }
              });
          });
  
      }
      
      function loadHeaderCart() {
          $("#headerCart").load("/AjaxContent/HeaderCart");
      }
  }