Skip to content

Instantly share code, notes, and snippets.

@CuddleBunny
Created August 19, 2016 02:33
Show Gist options
  • Save CuddleBunny/4490e9a0816c6e4467f4e08fb122cfdc to your computer and use it in GitHub Desktop.
Save CuddleBunny/4490e9a0816c6e4467f4e08fb122cfdc to your computer and use it in GitHub Desktop.
[HttpGet]
public async Task<JsonResult> Get()
{
var users = dataContext.TrackingUsers.Include(u => u.TrackingVisits).ThenInclude(v => v.TrackingDevice);
var newton = JsonConvert.SerializeObject(users);
var json_net = Json(users);
return json_net;
}
public class TrackingUserModel : Entity {
public TrackingUserModel() {
IsBanned = false;
}
public String Email { get; set; }
public Boolean IsBanned { get; set; }
public List<TrackingVisitModel> TrackingVisits { get; set; }
}
public class TrackingDeviceModel : Entity {
public String HardwareModel { get; set; }
public String OS { get; set; }
public String OSVersion { get; set; }
public List<TrackingVisitModel> TrackingVisits { get; set; }
}
public class TrackingVisitModel : Entity {
public TrackingVisitModel() {
DateTime = DateTime.Now;
}
public Guid TrackingUserId { get; set; }
public TrackingUserModel TrackingUser { get; set; }
public Guid TrackingDeviceId { get; set; }
public TrackingDeviceModel TrackingDevice { get; set; }
public Guid AppId { get; set; }
public String AppVersion { get; set; }
public DateTime DateTime { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment