public ActionResult DeleteConfirmed(int id)
        {
            Accounting_entries accounting_entries = db.Accounting_entries.Find(id);

            db.Accounting_entries.Remove(accounting_entries);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "AsientoContableId,AuxiliarId,AsientoContableFecha,AsientoContableDescripcion,AsientoContableCuentaDebito,AsientoContableCuentaCredito,AsientoContableMonto,AsientoContableEstado")] Accounting_entries accounting_entries)
 {
     if (ModelState.IsValid)
     {
         db.Entry(accounting_entries).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(accounting_entries));
 }
        // GET: Accounting_entries/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Accounting_entries accounting_entries = db.Accounting_entries.Find(id);

            if (accounting_entries == null)
            {
                return(HttpNotFound());
            }
            return(View(accounting_entries));
        }
        public ActionResult EnviarAsientoContable(int id)
        {
            try
            {
                var accounting_Entries = db.Accounting_entries.Where(x => x.AsientoContableId == id).Select(a => new {
                    AuxiliarId = 7,
                    a.AsientoContableDescripcion,
                    a.AsientoContableCuentaDebito,
                    a.AsientoContableCuentaCredito,
                    a.AsientoContableMonto
                }).FirstOrDefault();

                using (HttpClient client = new HttpClient())
                {
                    var contenido_http = JsonConvert.SerializeObject(accounting_Entries);

                    var buffer = System.Text.Encoding.UTF8.GetBytes(contenido_http);

                    var byteContent = new ByteArrayContent(buffer);

                    byteContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");

                    var result = client.PostAsync("https://contabilidadpropietaria.azurewebsites.net/api/asientocontable/external", byteContent).Result;

                    var result_message = result.Content.ReadAsStringAsync().Result;

                    if (!string.IsNullOrWhiteSpace(result_message) && Utilities.IsNumber(result_message))
                    {
                        Accounting_entries to_save = db.Accounting_entries.Find(id);

                        to_save.AsientoContableExternoId = Convert.ToInt32(result_message);

                        db.SaveChanges();
                    }
                }

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                return(RedirectToAction("Index"));
            }
        }