コード例 #1
0
        public async Task <IHttpActionResult> PutCajaDepto(int id, CajaDepto cajaDepto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != cajaDepto.IDCajaDepto)
            {
                return(BadRequest());
            }

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

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CajaDeptoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            CajaDepto cajaDepto = await db.CajaDeptoes.FindAsync(id);

            db.CajaDeptoes.Remove(cajaDepto);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
コード例 #3
0
        public async Task <IHttpActionResult> GetCajaDepto(int id)
        {
            CajaDepto cajaDepto = await db.CajaDeptoes.FindAsync(id);

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

            return(Ok(cajaDepto));
        }
コード例 #4
0
        public async Task <ActionResult> Edit([Bind(Include = "IDCajaDepto,NombreCajaDepto")] CajaDepto cajaDepto)
        {
            if (ModelState.IsValid)
            {
                db.Entry(cajaDepto).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(cajaDepto));
        }
コード例 #5
0
        public async Task <IHttpActionResult> PostCajaDepto(CajaDepto cajaDepto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.CajaDeptoes.Add(cajaDepto);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = cajaDepto.IDCajaDepto }, cajaDepto));
        }
コード例 #6
0
        public async Task <ActionResult> Create([Bind(Include = "IDCajaDepto,NombreCajaDepto")] CajaDepto cajaDepto)
        {
            if (ModelState.IsValid)
            {
                db.CajaDeptoes.Add(cajaDepto);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(cajaDepto));
        }
コード例 #7
0
        public async Task <IHttpActionResult> DeleteCajaDepto(int id)
        {
            CajaDepto cajaDepto = await db.CajaDeptoes.FindAsync(id);

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

            db.CajaDeptoes.Remove(cajaDepto);
            await db.SaveChangesAsync();

            return(Ok(cajaDepto));
        }
コード例 #8
0
        // GET: CajaDeptoes/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CajaDepto cajaDepto = await db.CajaDeptoes.FindAsync(id);

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