Exemplo n.º 1
0
        public static int DeleteCityStateZip(CityStateZipViewModel cityStateZip)
        {
            try
            {
                // Convert the view model object to a service proxy object.
                SP.CityStateZipSvc.CityStateZip request = cityStateZip.ToModel();

                // Call the service delete method.
                _cityStateZipClient.DeleteCityStateZip(request);

                return 1;
            }
            catch (System.ServiceModel.FaultException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Converts a CityStateZip service proxy object to a WebClient object.
        /// </summary>
        /// <param name="cityStateZip">CityStateZip service proxy</param>
        /// <returns>CityStateZip WebClient object to be used in the UI.</returns>
        public static VM.CityStateZipViewModel ToViewModel(this SP.CityStateZipSvc.CityStateZip cityStateZip)
        {
            VM.CityStateZipViewModel result = new VM.CityStateZipViewModel()
            {
                CityStateZipGuid = cityStateZip.CityStateZipGuid,
                City = cityStateZip.City,
                State = cityStateZip.State,
                ZipCode = cityStateZip.ZipCode,
            };

            return result;
        }
 public void RemoveCityStateZip(CityStateZipViewModel cityStateZip)
 {
     _cityStateZipVMs.Remove(cityStateZip);
 }
 public void AddCityStateZip(CityStateZipViewModel cityStateZip)
 {
     _cityStateZipVMs.Add(cityStateZip);
 }
Exemplo n.º 5
0
        public static int InsertCityStateZip(CityStateZipViewModel cityStateZip)
        {
            if (null == cityStateZip)
            {
                throw new Exception("Cannot insert CityStateZip. The cityStateZip object was null. Cannot be empty.");
            }

            try
            {
                // Convert the view model object to a service proxy object.
                SP.CityStateZipSvc.CityStateZip request = cityStateZip.ToModel();

                // Call the service insert method.
                _cityStateZipClient.InsertCityStateZip(request);

                return 1;
            }
            catch (System.ServiceModel.FaultException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }