-1

Hi ive created a actionresult procedure for a create event for the kendo scheduler, everything works find in c# but having a problem when i convert it to VB. here is my code

  Public Function Tasks_Create(<DataSourceRequest> request As DataSourceRequest, task As TaskViewModel) As ActionResult
    If ModelState.IsValid Then
        Using sampleDB = New MerchantEntities()
            'Create a new Task entity and set its properties from the posted TaskViewModel
            Dim MyEntity = New Task() With { _
            .TaskID = task.TaskID, _
            .Start = task.Start, _
            .End = task.End, _
            .Title = task.Title, _
            .Description = task.Description, _
            .OwnerID = task.OwnerID, _
            .IsAllDay = task.IsAllDay, _
            .RecurrenceID = task.RecurrenceID, _
            .RecurrenceException = task.RecurrenceException, _
            .StartTimeZone = task.StartTimezone, _
            .EndTimeZone = task.EndTimezone _
        }
            sampleDB.Tasks.Add(MyEntity)
            sampleDB.SaveChanges()
            task.TaskID = MyEntity.TaskID
        End Using
    End If
Return Json(New () {task}.ToDataSourceResult(request, ModelState))
End Function

My problem lies in the return. im not sure what to return back. the error is at the "New ()" of the return which VS keeps telling me "Type Expected" i've tried many things but can't seem to get it right. Can anyone see what im doing wrong?? Thank you

Lars Höppner
  • 18,252
  • 2
  • 45
  • 73
Costas Aletrari
  • 387
  • 5
  • 22

1 Answers1

1

the only thing that needs to be done is to remove the new () in the return and everything works fine.

Costas Aletrari
  • 387
  • 5
  • 22