Advertisement
Guest User

VIEWTRANSACTION

a guest
Aug 25th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. @model StudentCouncilEventManager.ViewModels.EventInfoViewModel
  2.  
  3. @{
  4. ViewBag.Title = "EventInfo";
  5. Layout = "~/Views/Shared/_Layout.cshtml";
  6. }
  7.  
  8. <h2>@Model.SchoolEvent.Name Info</h2>
  9.  
  10. <table class="table table-bordered" table-hover>
  11. <thead>
  12. <tr>
  13. <th>Product Name</th>
  14. <th>Product Price</th>
  15. <th>Product Cost to Manufacture</th>
  16. <th>Is Taxable</th>
  17. </tr>
  18. </thead>
  19.  
  20. <tbody>
  21. @foreach (var product in Model.Products)
  22. {
  23. if (Model.SchoolEvent.Id == product.EventProductIsSoldAtId)
  24. {
  25. <tr>
  26. <td style="text-align: center">@product.Name</td>
  27. <td style="text-align: center">@product.Price</td>
  28. <td style="text-align: center">@product.CostToManufacture</td>
  29. <td style="text-align: center">@product.IsTaxable</td>
  30. </tr>
  31. }
  32. }
  33.  
  34. </tbody>
  35. </table>
  36.  
  37. <h2>Transactions</h2>
  38.  
  39. <table class="table table-bordered" table-hover>
  40. <thead>
  41. <tr>
  42. <th>Product Name</th>
  43. <th>Product Price</th>
  44. <th>Product Cost to Manufacture</th>
  45. <th>Is Taxable</th>
  46. </tr>
  47. </thead>
  48.  
  49. <tbody>
  50. @foreach (var transaction in Model.ProductTransactions.GroupBy(p => p.TransactionId).Select(i => i.First()).ToList())
  51. {
  52. if (transaction.SchoolEventId == Model.SchoolEvent.Id) // runs code below if transaction belongs to school events
  53. {
  54. <tr>
  55. <td style="text-align: center">supposed to be product name</td>
  56. <td style="text-align: center">@transaction.Id</td>
  57. <td style="text-align: center">@transaction.DiscountPercentage</td>
  58. <td style="text-align: center">@transaction.AmountOfProductSold</td>
  59. </tr>
  60. }
  61.  
  62. }
  63. </tbody>
  64. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement