public IHttpActionResult PutCongragacion(int id, Congragacion congragacion)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != congragacion.Id)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#2
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Congragacion congragacion = await db.Congragacions.FindAsync(id);

            db.Congragacions.Remove(congragacion);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public IHttpActionResult GetCongragacion(int id)
        {
            Congragacion congragacion = db.Congragacions.Find(id);

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

            return(Ok(congragacion));
        }
示例#4
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Nombre,Usuario,Password,Direccion,Circuito")] Congragacion congragacion)
        {
            if (ModelState.IsValid)
            {
                db.Entry(congragacion).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(congragacion));
        }
        public IHttpActionResult PostCongragacion(Congragacion congragacion)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Congragacions.Add(congragacion);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = congragacion.Id }, congragacion));
        }
示例#6
0
        public async Task <ActionResult> Create([Bind(Include = "Id,Nombre,Usuario,Password,Direccion,Circuito")] Congragacion congragacion)
        {
            if (ModelState.IsValid)
            {
                db.Congragacions.Add(congragacion);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(congragacion));
        }
        public IHttpActionResult DeleteCongragacion(int id)
        {
            Congragacion congragacion = db.Congragacions.Find(id);

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

            db.Congragacions.Remove(congragacion);
            db.SaveChanges();

            return(Ok(congragacion));
        }
示例#8
0
        // GET: Congragacions/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Congragacion congragacion = await db.Congragacions.FindAsync(id);

            if (congragacion == null)
            {
                return(HttpNotFound());
            }
            return(View(congragacion));
        }