Click here to Skip to main content
15,896,207 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am creating an MVC application where I am sending an email to JIRA. I initially had it working like this:
In the controller:
VB
Public Function SubmitIssue(<Bind(Include:="IssueID,IssueSummary,IssueDescription")>
issuetable As IssueTable) As ActionResult

mail.Subject = issuetable.IssueSummary
Dim body As String = issuetable.IssueDescription

In the view:
VB
@ModelType IssueTable

@Html.EditorFor(Function(model) model.IssueSummary)
@Html.EditorFor(Function(model) model.IssueDescription)

This initially worked but I needed to have multiple tables to send data so I created a viewModel like this:
VB
Public Class ViewModel
    Public proTableList As List(Of ProjectType)
    Public cTableList As List(Of ClientTable)
    Public proTable As ProjectType
    Public iTable As IssueTable
End Class

In the view I displayed information like this:
VB
@ModelType IssueTracker.ViewModel

@Html.EditorFor(Function(model) model.iTable.IssueSummary)
@Html.EditorFor(Function(model) model.iTable.IssueDescription)

Now the problem lies in my in the controller because the way I am trying to populate the description and summary like this I get a null error:
VB
Public Function SubmitIssue(<Bind(Include:="IssueID,IssueSummary,IssueDescription")>
test As IssueTracker.ViewModel.ClientUserProjectIssue) As ActionResult

mail.Subject = test.iTable.IssueSummary
Dim body As String = test.iTable.IssueDescription

This is not the correct way to get a value into a variable / email by using a viewModel, does anyone know how I can do this correctly? (Can be explained using c# or vba as I can code in both but for this project I had to code using vba)
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900