Exemplo n.º 1
0
        public IHttpActionResult DeleteCAJA_POR_SUCURSAL(int idCaja, int idSucursal)
        {
            CAJA_POR_SUCURSAL cAJA_POR_SUCURSAL = db.CAJA_POR_SUCURSAL.Find(idCaja, idSucursal);

            if (cAJA_POR_SUCURSAL == null)
            {
                return(NotFound());
            }
            cAJA_POR_SUCURSAL.Estado          = "I"; //sets the state inactive (DELETION)
            db.Entry(cAJA_POR_SUCURSAL).State = EntityState.Modified;
            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CAJA_POR_SUCURSALExists(idCaja, idSucursal))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Ok(cAJA_POR_SUCURSAL));
        }
Exemplo n.º 2
0
        public IHttpActionResult PostCAJA_POR_SUCURSAL(CAJA_POR_SUCURSAL cAJA_POR_SUCURSAL)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.CAJA_POR_SUCURSAL.Add(cAJA_POR_SUCURSAL);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (CAJA_POR_SUCURSALExists(cAJA_POR_SUCURSAL.IdCaja, cAJA_POR_SUCURSAL.IdSucursal))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }
            //custom change
            return(Ok(cAJA_POR_SUCURSAL));
        }