Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            RUC rUC = db.RUC.Find(id);

            db.RUC.Remove(rUC);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
 public ActionResult Edit([Bind(Include = "IdRUC,RUCName")] RUC rUC)
 {
     if (ModelState.IsValid)
     {
         db.Entry(rUC).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(rUC));
 }
Esempio n. 3
0
        public ActionResult Create([Bind(Include = "IdRUC,RUCName")] RUC rUC)
        {
            if (ModelState.IsValid)
            {
                db.RUC.Add(rUC);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(rUC));
        }
Esempio n. 4
0
        // GET: RUCs/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RUC rUC = db.RUC.Find(id);

            if (rUC == null)
            {
                return(HttpNotFound());
            }
            return(View(rUC));
        }
Esempio n. 5
0
        public async static Task <RUC> GetRuc(string ruc)
        {
            string         endpoint = $"https://api.selvafood.com/api/consultaruc/{ruc}";
            HttpWebRequest request  = WebRequest.Create(endpoint) as HttpWebRequest;

            request.Method      = "GET";
            request.ContentType = "application/json";

            HttpWebResponse response = await request.GetResponseAsync() as HttpWebResponse;

            StreamReader reader = new StreamReader(response.GetResponseStream());
            string       json   = await reader.ReadToEndAsync();

            RUC rucObtained = JsonConvert.DeserializeObject <RUC>(json);

            return(rucObtained);
        }
Esempio n. 6
0
        private async Task GetRuc()
        {
            bool canConvert = long.TryParse(txtRUC.Text, out long Ruc);

            if (canConvert && txtRUC.Text.Length == 11)
            {
                try
                {
                    RUC ruc = await ConsultaRuc.GetRuc(txtRUC.Text);

                    if (ruc != null)
                    {
                        txtRazonSocial.Text = ruc.datos.result.razon_social;
                        txtDireccion.Text   = ruc.datos.result.direccion;
                    }
                    await Dispatcher.BeginInvoke(new System.Action(() => { Keyboard.Focus(txtRepresentanteLegal); }),
                                                 System.Windows.Threading.DispatcherPriority.Loaded);
                }
                catch (Exception ex)
                {
                    DialogResult result = CustomMessageBox.Show($"{ex.Message}", CustomMessageBox.CMessageBoxTitle.Información, CustomMessageBox.CMessageBoxButton.Aceptar, CustomMessageBox.CMessageBoxButton.No);
                }
            }
        }