Beispiel #1
0
 public ActionResult Edit([Bind(Include = "cbf_id,cln_id,cbf_dateOfCreated")] CabezaFactura cabezaFactura)
 {
     if (ModelState.IsValid)
     {
         CabezaFacturaBLL.Update(cabezaFactura);
         return(RedirectToAction("Index"));
     }
     ViewBag.cln_id = new SelectList(ClienteBLL.List(), "cln_id", "cln_tipo", cabezaFactura.cln_id);
     return(View(cabezaFactura));
 }
 public ActionResult Edit([Bind(Include = "crf_id,cbf_id,car_id")] CuerpoFactura cuerpoFactura)
 {
     if (ModelState.IsValid)
     {
         CuerpoFacturaBLL.Update(cuerpoFactura);
         return(RedirectToAction("Index"));
     }
     ViewBag.cbf_id = new SelectList(CabezaFacturaBLL.List(), "cbf_id", "cbf_id", cuerpoFactura.cbf_id);
     ViewBag.car_id = new SelectList(CarritoBLL.List(), "car_id", "car_tipo", cuerpoFactura.car_id);
     return(View(cuerpoFactura));
 }
 public IHttpActionResult Delete(int id)
 {
     try
     {
         CabezaFacturaBLL.Delete(id);
         return(Ok("Facturaa eliminada correctamente"));
     }
     catch (Exception ex)
     {
         return(Content(HttpStatusCode.BadRequest, ex));
     }
 }
 public IHttpActionResult Get()
 {
     try
     {
         List <CabezaFactura> todos = CabezaFacturaBLL.List();
         return(Content(HttpStatusCode.OK, todos));
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }
 public IHttpActionResult Get(int id)
 {
     try
     {
         CabezaFactura cabezaFactura = CabezaFacturaBLL.Get(id);
         return(Content(HttpStatusCode.OK, cabezaFactura));
     }
     catch (Exception)
     {
         return(NotFound());
     }
 }
 public IHttpActionResult Post(CabezaFactura cabezaFactura)
 {
     try
     {
         CabezaFacturaBLL.Create(cabezaFactura);
         return(Content(HttpStatusCode.Created, "Factura creado correctamente"));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
        public IHttpActionResult Put(CabezaFactura cabezaFactura)
        {
            try
            {
                CabezaFacturaBLL.Update(cabezaFactura);

                return(Content(HttpStatusCode.OK, "Factura actualizada correctamente"));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message + cabezaFactura.ToString()));
            }
        }
Beispiel #8
0
        // GET: CabezaFacturas/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CabezaFactura cabezaFactura = CabezaFacturaBLL.Get(id);

            if (cabezaFactura == null)
            {
                return(HttpNotFound());
            }
            return(View(cabezaFactura));
        }
Beispiel #9
0
        // GET: CabezaFacturas/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CabezaFactura cabezaFactura = CabezaFacturaBLL.Get(id);

            if (cabezaFactura == null)
            {
                return(HttpNotFound());
            }
            ViewBag.cln_id = new SelectList(db.Cliente, "cln_id", "cln_tipo", cabezaFactura.cln_id);
            return(View(cabezaFactura));
        }
        // GET: CuerpoFacturas/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CuerpoFactura cuerpoFactura = CuerpoFacturaBLL.Get(id);

            if (cuerpoFactura == null)
            {
                return(HttpNotFound());
            }
            ViewBag.cbf_id = new SelectList(CabezaFacturaBLL.List(), "cbf_id", "cbf_id", cuerpoFactura.cbf_id);
            ViewBag.car_id = new SelectList(CarritoBLL.List(), "car_id", "car_tipo", cuerpoFactura.car_id);
            return(View(cuerpoFactura));
        }
 public IHttpActionResult GenerateFacturaByCli(int id)
 {
     try
     {
         CabezaFactura cabezaFactura = CabezaFacturaBLL.GetCabFactByCli(id);
         if (cabezaFactura == null)
         {
             return(Content(HttpStatusCode.NotFound, "Factura no encontrada"));
         }
         else
         {
             return(Content(HttpStatusCode.OK, cabezaFactura));
         }
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Beispiel #12
0
 // GET: CabezaFacturas
 public ActionResult Index()
 {
     return(View(CabezaFacturaBLL.List()));
 }
Beispiel #13
0
 public ActionResult DeleteConfirmed(int id)
 {
     CabezaFacturaBLL.Delete(id);
     return(RedirectToAction("Index"));
 }
 // GET: CuerpoFacturas/Create
 public ActionResult Create()
 {
     ViewBag.cbf_id = new SelectList(CabezaFacturaBLL.List(), "cbf_id", "cbf_id");
     ViewBag.car_id = new SelectList(CarritoBLL.List(), "car_id", "car_tipo");
     return(View());
 }