Gcobani Mkontwana

Gcobani Mkontwana

  • 566
  • 1.9k
  • 405.9k

Email invoice functionality and Continue shopping in mvc asp.net 5

Nov 25 2020 6:27 AM
Hi Team
 
I need some help, i got two buttons that want to implement, on both View and Server side. I will share the code below on Javascript side and C#. Basically i want to create a functionality that will allow user to continue shopping and email button will send invoice to a user.
  1. <!--javascript libraries-->  
  2. <script type="text/javascript">  
  3.     $(function () {  
  4.         $("#btnEmail").click(function () {  
  5.             var contents = $("#dvContents").html();  
  6.             var frame1 = $('<iframe />');  
  7.             frame1[0].name = "frame1";  
  8.             frame1.css({ "position""absolute""top""-1000000px" });  
  9.             $("body").append(frame1);  
  10.             var frameDoc = frame1[0].contentWindow ? frame1[0].contentWindow : frame1[0].contentDocument.document ? frame1[0].contentDocument.document : frame1[0].contentDocument;  
  11.             frameDoc.document.open();  
  12.   
  13.             //create a new html document.  
  14.             frameDoc.document.write('<html><head><title>DIV Contents</title>');  
  15.             frameDoc.document.write('</head><body>');  
  16.   
  17.             // append external css file.  
  18.             frameDoc.document.write('<link href="style.css" rel="stylesheet" type="text/css" />');  
  19.   
  20.             // append the div contents.  
  21.             frameDoc.document.write(contents);  
  22.             frameDoc.document.write('</body></html>');  
  23.             frameDoc.document.close();  
  24.             setTimeout(function () {  
  25.                 windows.frames["frame1"].focus();  
  26.                 windows.frames["frame1"].print();  
  27.                 frame1.remove();  
  28.             }, 500);  
  29.         });  
  30.     });  
  31. </script>   
  32.   
  33. <button type="button" id="btnPrint" class="btn btn-primary">Email</button>  
  34.     <button type="button" class="btn btn-success">Continue Shopping</button>  
  35.     <button type="button" class="btn btn-warning">Place Order</button>  
  36.   
  37. // Model  
  38. public class TrainingAcademy_Courses  
  39.     {  
  40.         public int ? CourseNo { getset; }  
  41.         public double Price { getset; }  
  42.         public string Venue { getset; }  
  43.         public string CourseDetails { getset; }  
  44.         public string Url { getset; }  
  45.         public string ZoomUrl { getset; }  
  46.         public string CourseInstructor { getset; }  
  47.     }  
  48. // Controller  
  49.  public ActionResult eNtsaPaymentOrders()  
  50.         {  
  51.             return View((List<TrainingAcademy_Courses>)Session["cart"]);  
  52.         }  
 

Answers (2)