Esempio n. 1
0
        /// <summary>
        ///     Actualiza el email y el telefono del derechohabiente
        /// </summary>
        /// <param name="curp">CURP del derechohabiente</param>
        /// <param name="EntitleViewModel">Información a actualizar</param>
        public async Task UpdateEntitledInfoAsync(string curp, EntitleViewModel info)
        {
            var token = GetToken();

            var baseAddress = ServiceBaseUrl + String.Format(EntitleByCurpInfoUrl, curp);
            var http        = BuildHttpClient(baseAddress, token);

            var response =
                await
                http.PutAsync(baseAddress,
                              new StringContent(JsonConvert.SerializeObject(info), Encoding.UTF8, HttpContants.ContentTypes.Json));

            response.EnsureSuccessStatusCode();
        }
        public Task <int> SaveEntitle(Entitle entitle)
        {
            try
            {
                _context.Entitles.AddOrUpdate(entitle);

                if (!String.IsNullOrEmpty(entitle.Email) && !String.IsNullOrEmpty(entitle.Telephone))
                {
                    var entitleViewModel = new EntitleViewModel
                    {
                        Email     = entitle.Email,
                        Telephone = entitle.Telephone
                    };
                    _sipeAv.UpdateEntitledInfoAsync(entitle.CURP, entitleViewModel);
                }
                return(_context.SaveChangesAsync());
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }