Ejemplo n.º 1
0
        internal bool ValidarDestino(Destino_Web destino, bool esCrear)
        {
            _dictionaryError = new Dictionary <string, string>();

            if (string.IsNullOrEmpty(destino.Nombre) || string.IsNullOrWhiteSpace(destino.Nombre))
            {
                _dictionaryError.Add("Nombre", "Este campo es obligatorio.");
            }

            if (destino.Valor <= 0)
            {
                _dictionaryError.Add("Valor", "Este campo es obligatorio.");
            }

            return(_dictionaryError.Count() == 0);
        }
Ejemplo n.º 2
0
        public async Task <bool> Read(int id)
        {
            try
            {
                HttpResponseMessage responseMessage = await client.GetAsync(string.Format("{0}/{1}/{2}", url, "destino", id));

                if (responseMessage.IsSuccessStatusCode)
                {
                    var         responseData = responseMessage.Content.ReadAsStringAsync().Result;
                    Destino_Web retorno      = JsonConvert.DeserializeObject <Destino_Web>(responseData);

                    MappingThisFromAnother(retorno);
                    return(true);
                }
                return(false);
            }
            catch (Exception)
            {
                return(false);

                throw;
            }
        }
Ejemplo n.º 3
0
 public void MappingThisFromAnother(Destino_Web objeto)
 {
     this.Id     = objeto.Id;
     this.Nombre = objeto.Nombre;
     this.Valor  = objeto.Valor;
 }