public PoliceEventEntity(PoliceEvent pe) { Id = pe.Id; UtcDateTime = pe.UtcDateTime; Summary = pe.Summary; Url = pe.Url; Type = pe.Type; Location = pe.Location; if (Location != null) { Geo = new Geo(Location.Lng, Location.Lat); } }
/// <summary> /// Converts the external model to an internal PoliceEvent-model /// </summary> /// <returns>A PoliceEvent object</returns> public PoliceEvent GetPoliceEvent() { var e = new PoliceEvent { Id = Id, UtcDateTime = DateTime.Parse(Datetime).ToUniversalTime(), Summary = Summary, Url = Url, Type = Type }; var parts = Location.Gps.Split(","); e.Location = new Location { Name = Location.Name, Lat = double.Parse(parts[0], Provider), Lng = double.Parse(parts[1], Provider) }; return(e); }