public OnlandVisualTrashAssessmentObservationSimple(OnlandVisualTrashAssessmentObservation o) { OnlandVisualTrashAssessmentObservationID = o.OnlandVisualTrashAssessmentObservationID; OnlandVisualTrashAssessmentID = o.OnlandVisualTrashAssessmentID; Note = o.Note; ObservationDateTime = o.ObservationDatetime; LocationX = o.LocationPoint4326.XCoordinate.GetValueOrDefault(); LocationY = o.LocationPoint4326.YCoordinate.GetValueOrDefault(); // todo: ensure there is a database constraint ensuring one photo per observo var photo = o.OnlandVisualTrashAssessmentObservationPhotos.SingleOrDefault(); PhotoID = photo ?.OnlandVisualTrashAssessmentObservationPhotoID; PhotoUrl = photo?.FileResource.GetFileResourceUrl(); }
/// <summary> /// Creates a "blank" object of this type and populates primitives with defaults /// </summary> public static OnlandVisualTrashAssessmentObservationPhoto CreateNewBlank(FileResource fileResource, OnlandVisualTrashAssessmentObservation onlandVisualTrashAssessmentObservation) { return(new OnlandVisualTrashAssessmentObservationPhoto(fileResource, onlandVisualTrashAssessmentObservation)); }
public static void DeleteOnlandVisualTrashAssessmentObservation(this IQueryable <OnlandVisualTrashAssessmentObservation> onlandVisualTrashAssessmentObservations, OnlandVisualTrashAssessmentObservation onlandVisualTrashAssessmentObservationToDelete) { DeleteOnlandVisualTrashAssessmentObservation(onlandVisualTrashAssessmentObservations, new List <OnlandVisualTrashAssessmentObservation> { onlandVisualTrashAssessmentObservationToDelete }); }
/// <summary> /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible /// </summary> public OnlandVisualTrashAssessmentObservationPhoto(FileResource fileResource, OnlandVisualTrashAssessmentObservation onlandVisualTrashAssessmentObservation) : this() { // Mark this as a new object by setting primary key with special value this.OnlandVisualTrashAssessmentObservationPhotoID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue(); this.FileResourceID = fileResource.FileResourceID; this.FileResource = fileResource; fileResource.OnlandVisualTrashAssessmentObservationPhotos.Add(this); this.OnlandVisualTrashAssessmentObservationID = onlandVisualTrashAssessmentObservation.OnlandVisualTrashAssessmentObservationID; this.OnlandVisualTrashAssessmentObservation = onlandVisualTrashAssessmentObservation; onlandVisualTrashAssessmentObservation.OnlandVisualTrashAssessmentObservationPhotos.Add(this); }