-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

4

1 回答 1

1

唯一需要做的就是删除 return 中的 new () ,一切正常。

于 2014-02-18T08:47:18.353 回答