I have a TypeScript model that looks like this:
import * as moment from 'moment';
export class Activity {
public id: number;
public activityDate: string;
public day: number = moment(this.activityDate).dayOfYear();
}
Also, a C# model is sent by WebApi in this format:
public class Activity
{
[JsonProperty("id")]
public int Id { get; set; }
[JsonProperty("activityDate")]
public DateTime ActivityDate { get; set; }
}
There is a mapping using a simple response.json()
in my service class.
My concern is that the property day
disappears from my model.ts.
Is there a way to declare something to maintain integrity in the TypeScript model? Or any binding on model retrieval keep the structure intact?