예제 #1
0
        public ActionResult Edit([ModelBinder(typeof(DevExpress.Web.Mvc.DevExpressEditorsBinder))] Garantias garantia)
        {
            //if (!ModelState.IsValid)
            //    return View("Edit", garantia);

            if (garantia.IdGarantia == -1)
            {
                garantia.Cantidad      = 0;
                garantia.AreaTerreno   = "0";
                garantia.Valor1        = 0;
                garantia.Valor2        = 0;
                garantia.Valor3        = 0;
                garantia.IdPropietario = 0;
                db.Garantias.Add(garantia);
                db.SaveChanges();
            }
            else
            {
                garantia.Cantidad        = 0;
                garantia.AreaTerreno     = "0";
                garantia.Valor1          = 0;
                garantia.Valor2          = 0;
                garantia.Valor3          = 0;
                garantia.IdPropietario   = 100079;
                db.Entry(garantia).State = EntityState.Modified;
                db.SaveChanges();
            }
            return(RedirectToAction("Index"));
        }
예제 #2
0
        public ActionResult Delete(int IdGarantia)
        {
            Garantias garantias = db.Garantias.Find(IdGarantia);

            db.Garantias.Remove(garantias);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #3
0
        //public ActionResult Edit()
        //{
        //    return View("Edit", new AjaxFormValidationData());
        //}
        //[HttpPost]
        //public ActionResult Edit(AjaxFormValidationData validationData)
        //{
        //    if (!Request.IsAjaxRequest())
        //    { // Theme changing
        //        ModelState.Clear();
        //        return View("Edit", validationData);
        //    }

        //    // Intentionally pauses server-side processing,
        //    // to demonstrate the Loading Panel functionality.
        //    Thread.Sleep(1000);
        //    if (ModelState.IsValid)
        //    {
        //        return PartialView("EditValidationSuccess", "Edit");
        //    }
        //    else
        //        return PartialView("AjaxEditPartial", validationData);
        //}



        //
        // GET: /Garantia/

        //public ActionResult Index()
        //{
        //    var garantias = db.vwGarantias;
        //    return View(garantias.ToList());
        //}

        //
        // GET: /Garantia/Details/5

        public ActionResult Details(long id = 0)
        {
            Garantias garantias = db.Garantias.Find(id);

            if (garantias == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IdEstado       = new SelectList(db.EstadoGarantias, "IdEstado", "EstadoGarantia");
            ViewBag.IdMoneda       = new SelectList(db.Monedas, "IdMoneda", "Moneda");
            ViewBag.IdMunicipio    = new SelectList(db.Municipios, "IdMunicipio", "Municipio");
            ViewBag.IdTipoBien     = new SelectList(db.vwTipoBienesDetalle, "IdTipoBien", "TipoBien");
            ViewBag.IdTipoGarantia = new SelectList(db.vwTipoGarantiasDetalle, "IdTipoGarantia", "TipoGarantia");
            return(View(garantias));
        }
예제 #4
0
        public ActionResult Edit([ModelBinder(typeof(DevExpress.Web.Mvc.DevExpressEditorsBinder))] long id = 0)
        {
            Garantias garantia = db.Garantias.Find(id);

            if (garantia == null)
            {
                garantia            = new Garantias();
                garantia.IdGarantia = -1;
            }

            ViewBag.IdTipoGarantia = db.vwTipoGarantiasDetalle.ToList();
            ViewBag.IdTipoBien     = db.vwTipoBienesDetalle.ToList();
            ViewBag.IdMoneda       = db.Monedas.ToList();
            ViewBag.IdEstado       = db.EstadoGarantias.ToList();
            ViewBag.IdMunicipio    = db.Municipios.ToList();

            return(View("Edit", garantia));
        }
예제 #5
0
        public ActionResult EditModesDeletePartial(int IdGarantia)
        {
            var gestores = db.vwGestores;

            if (IdGarantia >= 0)
            {
                try
                {
                    Garantias garantias = db.Garantias.Find(IdGarantia);
                    db.Garantias.Remove(garantias);
                    db.SaveChanges();
                }
                catch (System.Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            return(PartialView("EditPartial", gestores));
        }