Пример #1
0
        public IHttpActionResult DeleteCountryTranslation(int translationId)
        {
            CountryTranslationRequest request = new CountryTranslationRequest
            {
                CountryTranslationDto = new CountryTranslationDto
                {
                    TranslationId = translationId
                }
            };

            List <string>             errors  = ValidateDeleteCountryTranslation(request);
            CountryTranslationMessage message = new CountryTranslationMessage();

            if (errors != null && errors.Any())
            {
                message.ErrorMessage     = CountryMessageResource.ValidationErrors;
                message.ErrorType        = ErrorType.ValidationError;
                message.Errors           = new List <string>();
                message.OperationSuccess = false;
                message.Errors.AddRange(errors);
            }
            else
            {
                message = _serviceCountryTranslationClient.DeleteCountryTranslation(request);
            }
            return(Json(message));
        }
        /// <summary>
        /// Change CountryTranslation informations.
        /// </summary>
        /// <param name="request">countryTranslation request.</param>
        /// <returns>CountryTranslation message.</returns>
        public CountryTranslationMessage UpdateCountryTranslation(CountryTranslationRequest request)
        {
            CountryTranslationMessage message = new CountryTranslationMessage();

            try
            {
                _serviceCountryTranslation.UpdateCountryTranslation(request.ToPivot());
                message.OperationSuccess = true;
            }
            catch (Exception e)
            {
                message.ErrorType    = ErrorType.TechnicalError;
                message.ErrorMessage = e.Message;
            }
            return(message);
        }
        /// <summary>
        /// Get list of CountryTranslation
        /// </summary>
        /// <returns>CountryTranslation message.</returns>
        public CountryTranslationMessage GetAllCountryTranslations()
        {
            CountryTranslationMessage message = new CountryTranslationMessage();

            try
            {
                message = _serviceCountryTranslation.GetAllCountryTranslations().ToMessage();
                message.OperationSuccess = true;
            }
            catch (Exception e)
            {
                message.ErrorType    = ErrorType.TechnicalError;
                message.ErrorMessage = e.Message;
            }
            return(message);
        }
Пример #4
0
        public IHttpActionResult FindCountryTranslations(CountryTranslationRequest request)
        {
            List <string>             errors  = ValidateFindCountryTranslations(request);
            CountryTranslationMessage message = new CountryTranslationMessage();

            if (errors != null && errors.Any())
            {
                message.ErrorMessage     = CountryMessageResource.ValidationErrors;
                message.ErrorType        = ErrorType.ValidationError;
                message.Errors           = new List <string>();
                message.OperationSuccess = false;
                message.Errors.AddRange(errors);
            }
            else
            {
                message = _serviceCountryTranslationClient.FindCountryTranslations(request);
            }
            return(Json(message));
        }
Пример #5
0
        public IHttpActionResult GetAllCountryTranslations()
        {
            CountryTranslationMessage message = _serviceCountryTranslationClient.GetAllCountryTranslations();

            return(Json(message));
        }