Example #1
0
        public ShipCountryDisplay NewShipCountry(Guid catalogKey, string countryCode)
        {
            ShipCountry newShipCountry = null;

            try
            {
                //ICountry country = _storeSettingService.GetCountryByCode(countryCode);
                //newShipCountry = new ShipCountry(catalogKey, country);
                //_shipCountryService.Save(newShipCountry);
                //newShipCountry = _shipCountryService.GetShipCountryByCountryCode(catalogKey, countryCode) as ShipCountry;
                var attempt = ((ShipCountryService)_shipCountryService).CreateShipCountryWithKey(catalogKey, countryCode);
                if (attempt.Success)
                {
                    newShipCountry = attempt.Result as ShipCountry;
                }
                else
                {
                    throw attempt.Exception;
                }
            }
            catch (Exception ex)
            {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.InternalServerError));
            }

            return(newShipCountry.ToShipCountryDisplay());
        }