I have the following C# class:
public class JsonBackup
{
public int Added { set; get; }
public int DEVCount { set; get; }
public int DS1Count { s
Simplest way to achieve that is to create interface for IJsonBackup and when you receive json just cast it to IJsonBackup
interface IViewEvent
{
}
interface IJsonBackup
{
Added : number;
DEVCount : number;
DS1Count : number;
Events : IViewEvent[];
Errors : string[];
Rejected : number;
Success : bool;
Updated : number;
}
In your class definition:
backupDone(data: IJsonBackup, ajaxElapsed: any)
{
}
$.ajax("/Backup/Data/Backup",
{
cache: false,
dataType: 'json',
type: 'POST'
})
.done(function (data: any) {
console.log(data);
backupDone(<IJsonBackup>data, ajaxElapsed);
});