Exemple #1
0
        public IHttpActionResult PostCOMUNAS(COMUNAS cOMUNAS)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.COMUNAS.Add(cOMUNAS);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (COMUNASExists(cOMUNAS.COMUNA_ID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = cOMUNAS.COMUNA_ID }, cOMUNAS));
        }
Exemple #2
0
        public IHttpActionResult PutCOMUNAS(int id, COMUNAS cOMUNAS)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != cOMUNAS.COMUNA_ID)
            {
                return(BadRequest());
            }

            db.Entry(cOMUNAS).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!COMUNASExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #3
0
        public ActionResult DeleteConfirmed(long id)
        {
            COMUNAS cOMUNAS = db.COMUNAS.Find(id);

            db.COMUNAS.Remove(cOMUNAS);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #4
0
        public IHttpActionResult GetCOMUNAS(int id)
        {
            COMUNAS cOMUNAS = db.COMUNAS.Find(id);

            if (cOMUNAS == null)
            {
                return(NotFound());
            }

            return(Ok(cOMUNAS));
        }
Exemple #5
0
 public ActionResult Edit([Bind(Include = "ID_COMUNA,COMUNA,ID_REGION")] COMUNAS cOMUNAS)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cOMUNAS).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ID_REGION = new SelectList(db.REGIONES, "ID_REGION", "NOMBRE", cOMUNAS.ID_REGION);
     return(View(cOMUNAS));
 }
Exemple #6
0
 public ActionResult Edit([Bind(Include = "ID_COMUNA,ID_DISTRIRO,NOM_COMUNA")] COMUNAS cOMUNAS)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cOMUNAS).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ID_DISTRIRO = new SelectList(db.DISTRITOS, "ID_DISTRIRO", "NOM_DISTRITO", cOMUNAS.ID_DISTRIRO);
     return(View(cOMUNAS));
 }
Exemple #7
0
        public ActionResult Create([Bind(Include = "ID_COMUNA,COMUNA,ID_REGION")] COMUNAS cOMUNAS)
        {
            if (ModelState.IsValid)
            {
                db.COMUNAS.Add(cOMUNAS);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ID_REGION = new SelectList(db.REGIONES, "ID_REGION", "NOMBRE", cOMUNAS.ID_REGION);
            return(View(cOMUNAS));
        }
Exemple #8
0
        public ActionResult Create([Bind(Include = "ID_COMUNA,ID_DISTRIRO,NOM_COMUNA")] COMUNAS cOMUNAS)
        {
            if (ModelState.IsValid)
            {
                db.COMUNAS.Add(cOMUNAS);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ID_DISTRIRO = new SelectList(db.DISTRITOS, "ID_DISTRIRO", "NOM_DISTRITO", cOMUNAS.ID_DISTRIRO);
            return(View(cOMUNAS));
        }
Exemple #9
0
        public IHttpActionResult DeleteCOMUNAS(int id)
        {
            COMUNAS cOMUNAS = db.COMUNAS.Find(id);

            if (cOMUNAS == null)
            {
                return(NotFound());
            }

            db.COMUNAS.Remove(cOMUNAS);
            db.SaveChanges();

            return(Ok(cOMUNAS));
        }
Exemple #10
0
        // GET: COMUNAS/Details/5
        public ActionResult Details(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            COMUNAS cOMUNAS = db.COMUNAS.Find(id);

            if (cOMUNAS == null)
            {
                return(HttpNotFound());
            }
            return(View(cOMUNAS));
        }
Exemple #11
0
        // GET: COMUNAS/Edit/5
        public ActionResult Edit(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            COMUNAS cOMUNAS = db.COMUNAS.Find(id);

            if (cOMUNAS == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ID_REGION = new SelectList(db.REGIONES, "ID_REGION", "NOMBRE", cOMUNAS.ID_REGION);
            return(View(cOMUNAS));
        }
Exemple #12
0
        // GET: COMUNAS/Edit/5
        public ActionResult Edit(decimal id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            COMUNAS cOMUNAS = db.COMUNAS.Find(id);

            if (cOMUNAS == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ID_DISTRIRO = new SelectList(db.DISTRITOS, "ID_DISTRIRO", "NOM_DISTRITO", cOMUNAS.ID_DISTRIRO);
            return(View(cOMUNAS));
        }