Example #1
0
        public IHttpActionResult Puttb_factura(int id, tb_factura tb_factura)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tb_factura.NumeroFactura)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #2
0
        public IHttpActionResult Gettb_factura(int id)
        {
            tb_factura tb_factura = db.tb_factura.Find(id);

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

            return(Ok(tb_factura));
        }
Example #3
0
        public IHttpActionResult Posttb_factura(tb_factura tb_factura)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.tb_factura.Add(tb_factura);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = tb_factura.NumeroFactura }, tb_factura));
        }
Example #4
0
        public IHttpActionResult Deletetb_factura(int id)
        {
            tb_factura tb_factura = db.tb_factura.Find(id);

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

            db.tb_factura.Remove(tb_factura);
            db.SaveChanges();

            return(Ok(tb_factura));
        }