Example #1
0
        public static int DeleteOffering(OfferingViewModel offering)
        {
            try
            {
                // Convert the view model object to a service proxy object.
                SP.OfferingSvc.Offering request = offering.ToModel();

                // Call the service delete method.
                _offeringClient.DeleteOffering(request);

                return 1;
            }
            catch (System.ServiceModel.FaultException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        public static int InsertOffering(OfferingViewModel offering)
        {
            if (null == offering)
            {
                throw new Exception("Cannot insert Offering. The offering object was null. Cannot be empty.");
            }

            try
            {
                // Convert the view model object to a service proxy object.
                SP.OfferingSvc.Offering request = offering.ToModel();

                // Call the service insert method.
                _offeringClient.InsertOffering(request);

                return 1;
            }
            catch (System.ServiceModel.FaultException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public void AddOffering(OfferingViewModel offering)
 {
     _offeringVMs.Add(offering);
 }
 public void RemoveOffering(OfferingViewModel offering)
 {
     _offeringVMs.Remove(offering);
 }
Example #5
0
        /// <summary>
        /// Converts a Offering service proxy object to a WebClient object.
        /// </summary>
        /// <param name="offering">Offering service proxy</param>
        /// <returns>Offering WebClient object to be used in the UI.</returns>
        public static VM.OfferingViewModel ToViewModel(this SP.OfferingSvc.Offering offering)
        {
            VM.OfferingViewModel result = new VM.OfferingViewModel()
            {
                OfferingGuid = offering.OfferingGuid,
                OfferingID = offering.OfferingID,
                OfferingName = offering.OfferingName,
            };

            return result;
        }