Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "message": "System.InvalidCastException: Conversion from type 'JObject' to type 'String' is not valid.rn at Microsoft.VisualBasic.CompilerServices.Conversions.ToString(Object Value)rn at WebApplication7.Controllers.SubjectsController.getSubjects(Object data) in C:\Users\Junaida\documents\visual studio 2015\Projects\WebApplication7\WebApplication7\Controllers\SubjectsController.vb:line 30"
- <HttpPost>
- Function getSubjects(<FromBody> ByVal data As Object) As IHttpActionResult
- Try
- Using entities As IAPD_DBEntities = New IAPD_DBEntities()
- Dim year, type, id As String
- Dim dictionary = JsonConvert.DeserializeObject(data) 'As Dictionary(Of String, String)
- Dim startno As Integer = 0
- If year = 1 Then
- startno = 0
- ElseIf year = 2 And type = 1 Then
- startno = 366
- ElseIf year = 2 And type = 3 Then
- startno = 52
- ElseIf year = 2 And type = 2 Then
- startno = 13
- End If
- dictionary.Add("id", id)
- dictionary.Add("Type", type)
- dictionary.Add("Year", year)
- Return Ok(entities.SP_Messages_GetinfoArchive_ByID(startno, id, type, year).ToList)
- End Using
- Catch e As Exception
- Return BadRequest(e.ToString)
- End Try
- End Function
- End Class
Add Comment
Please, Sign In to add comment