Exemplo n.º 1
0
        public static int DeleteFacilityPhoto(FacilityPhotoViewModel facilityPhoto)
        {
            try
            {
                // Convert the view model object to a service proxy object.
                SP.FacilityPhotoSvc.FacilityPhoto request = facilityPhoto.ToModel();

                // Call the service delete method.
                _facilityPhotoClient.DeleteFacilityPhoto(request);

                return 1;
            }
            catch (System.ServiceModel.FaultException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        public static int InsertFacilityPhoto(FacilityPhotoViewModel facilityPhoto)
        {
            if (null == facilityPhoto)
            {
                throw new Exception("Cannot insert FacilityPhoto. The facilityPhoto object was null. Cannot be empty.");
            }

            try
            {
                // Convert the view model object to a service proxy object.
                SP.FacilityPhotoSvc.FacilityPhoto request = facilityPhoto.ToModel();

                // Call the service insert method.
                _facilityPhotoClient.InsertFacilityPhoto(request);

                return 1;
            }
            catch (System.ServiceModel.FaultException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
 public static FacilityPhotoCollection GetFacilityPhotosForFacilityByFacilityGuid(Guid facilityGuid)
 {
     SP.FacilityPhotoSvc.FacilityPhoto[] facilityPhotos = _facilityPhotoClient.GetFacilityPhotosForFacilityByFacilityGuid(facilityGuid);
     FacilityPhotoCollection result = new FacilityPhotoCollection();
     foreach (SP.FacilityPhotoSvc.FacilityPhoto facilityPhoto
         in facilityPhotos)
     {
         FacilityPhotoViewModel viewModel = new FacilityPhotoViewModel(facilityPhoto.FacilityPhotoGuid, facilityPhoto.PhotoUri, facilityPhoto.FacilityGuid);
         result.Add(viewModel);
     }
     return result;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Converts a FacilityPhoto service proxy object to a WebClient object.
        /// </summary>
        /// <param name="facilityPhoto">FacilityPhoto service proxy</param>
        /// <returns>FacilityPhoto WebClient object to be used in the UI.</returns>
        public static VM.FacilityPhotoViewModel ToViewModel(this SP.FacilityPhotoSvc.FacilityPhoto facilityPhoto)
        {
            VM.FacilityPhotoViewModel result = new VM.FacilityPhotoViewModel()
            {
                FacilityPhotoGuid = facilityPhoto.FacilityPhotoGuid,
                PhotoUri = facilityPhoto.PhotoUri,
                FacilityGuid = facilityPhoto.FacilityGuid,
            };

            return result;
        }
 public void RemoveFacilityPhoto(FacilityPhotoViewModel facilityPhoto)
 {
     _facilityPhotoVMs.Remove(facilityPhoto);
 }
 public void AddFacilityPhoto(FacilityPhotoViewModel facilityPhoto)
 {
     _facilityPhotoVMs.Add(facilityPhoto);
 }