public static int InsertOffering(int offeringID, string offeringName) { try { // Create the service proxy object and populate it. SP.OfferingSvc.Offering request = new SP.OfferingSvc.Offering(); request.OfferingGuid = Guid.Empty; request.OfferingID = offeringID; request.OfferingName = offeringName; // Call the service insert method. _offeringClient.InsertOffering(request); return 1; } catch (System.ServiceModel.FaultException ex) { throw ex; } catch (Exception ex) { throw ex; } }
/// <summary> /// Converts the Offering ViewModel into a Offering Model to be used with the service. /// </summary> /// <param name="offering">ViewModel to convert.</param> /// <returns>OfferingReturns null if parameter is null. Otherwise, returns Model to be used with the service.</returns> public static SP.OfferingSvc.Offering ToModel(this VM.OfferingViewModel offering) { if (null == offering) { return null; } SP.OfferingSvc.Offering result = new SP.OfferingSvc.Offering() { OfferingGuid = offering.OfferingGuid, OfferingID = offering.OfferingID, OfferingName = offering.OfferingName, }; return result; }