public ActionResult Delete(int id) { EcomData_ = new EcomData(StringConnectio); try { EcomData_.Connect(); Ecom_Abono_ = (Ecom_Abono)EcomData_.GetObject(DataModel.Abono); Ecom_Abono_.Id = id; bool result = Ecom_Abono_.Delete(); if (result) { return(Ok(EcomData_.GetLastMessage())); } else { return(BadRequest(EcomData_.GetLastMessage())); } } catch (Ecom_Exception ex) { return(BadRequest(ex.Message)); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult Create([FromBody] Ecom_Abono Ecom_Abono_) { EcomData_ = new EcomData(StringConnectio); try { EcomData_.Connect(); Ecom_Abono_ = (Ecom_Abono)EcomData_.SetObjectConnection(Ecom_Abono_, DataModel.Abono); if (Ecom_Abono_.Cliente == 0) { throw new Ecom_Exception("Por favor selecciona Cliente"); } bool result = Ecom_Abono_.Add(); if (result) { return(Ok(EcomData_.GetLastMessage())); } else { return(BadRequest(EcomData_.GetLastMessage())); } } catch (Ecom_Exception ex) { return(BadRequest(ex.Message)); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult Cotizar([FromBody] Ecom_Producto Ecom_Producto_) { EcomData_ = new EcomData(StringConnectio); try { EcomData_.Connect(); Ecom_Producto_ = (Ecom_Producto)EcomData_.SetObjectConnection(Ecom_Producto_, DataModel.Producto); if (Ecom_Producto_.Cliente == 0) { throw new Ecom_Exception("Por favor selecciona un cliente para la venta"); } bool result = Ecom_Producto_.Update(5); if (result) { return(Ok(EcomData_.GetLastMessage())); } else { return(BadRequest(EcomData_.GetLastMessage())); } } catch (Ecom_Exception ex) { return(BadRequest(ex.Message)); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult ConcelarVenta([FromBody] Ecom_Producto Ecom_Producto_) { EcomData_ = new EcomData(StringConnectio); try { EcomData_.Connect(); Ecom_Producto_ = (Ecom_Producto)EcomData_.SetObjectConnection(Ecom_Producto_, DataModel.Producto); bool result = Ecom_Producto_.Update(7); if (result) { return(Ok(EcomData_.GetLastMessage())); } else { return(BadRequest(EcomData_.GetLastMessage())); } } catch (Ecom_Exception ex) { return(BadRequest(ex.Message)); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult Recuperar([FromBody] Ecom_Inversiones Ecom_Inversiones_) { EcomData_ = new EcomData(StringConnectio); try { EcomData_.Connect(); Ecom_Inversiones_ = (Ecom_Inversiones)EcomData_.SetObjectConnection(Ecom_Inversiones_, DataModel.Inversioniones); bool result = Ecom_Inversiones_.Update(3); if (result) { return(Ok(EcomData_.GetLastMessage())); } else { return(BadRequest(EcomData_.GetLastMessage())); } } catch (Ecom_Exception ex) { return(BadRequest(ex.Message)); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
// GET: TipoProducto/Details/5 public ActionResult Details(int id) { EcomData_ = new EcomData(StringConnectio); try { EcomData_.Connect(); Ecom_Pedido_ = (Ecom_Pedido)EcomData_.GetObject(DataModel.Pedido); bool result = Ecom_Pedido_.Get(id); if (result) { return(View(Ecom_Pedido_)); } else { throw new Ecom_Exception(EcomData_.GetLastMessage()); } } catch (Ecom_Exception ex) { return(View("../ErrorPages/Error", new { id = ex.Message })); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult Delete(int id, IFormCollection collection) { EcomData_ = new EcomData(StringConnectio); try { EcomData_.Connect(); Ecom_Pedido_ = (Ecom_Pedido)EcomData_.GetObject(DataModel.Pedido); Ecom_Pedido_.Id = id; bool result = Ecom_Pedido_.Delete(); if (result) { return(RedirectToAction(nameof(Index))); } else { throw new Ecom_Exception(EcomData_.GetLastMessage()); } } catch (Ecom_Exception ex) { return(View("../ErrorPages/Error", new { id = ex.Message })); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult Delete(int id, IFormCollection collection) { EcomData_ = new EcomData(StringConnectio); try { EcomData_.Connect(); Ecom_PedidoAjuste_ = (Ecom_PedidoAjuste)EcomData_.GetObject(DataModel.PedidoAjuste); Ecom_PedidoAjuste_.Id = id; bool result2 = Ecom_PedidoAjuste_.Get(id); int perdido = Ecom_PedidoAjuste_.Pedido; bool result = Ecom_PedidoAjuste_.Delete(); if (result) { return(RedirectToAction("Details", "Pedido", new { Id = perdido })); } else { throw new Ecom_Exception(EcomData_.GetLastMessage()); } } catch (Ecom_Exception ex) { return(View("../ErrorPages/Error", new { id = ex.Message })); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult Create([FromBody] Ecom_Cliente Ecom_Cliente_) { //return RedirectToAction(nameof(Index)); EcomData_ = new EcomData(StringConnectio); try { if (!ModelState.IsValid) { throw new Ecom_Exception("Campos no validos"); } else { EcomData_.Connect(); Ecom_Cliente_ = (Ecom_Cliente)EcomData_.SetObjectConnection(Ecom_Cliente_, DataModel.Cliente); bool result = Ecom_Cliente_.Add(); if (result) { return(Ok(EcomData_.GetLastMessage())); } else { throw new Ecom_Exception(EcomData_.GetLastMessage()); } } } catch (Ecom_Exception ex) { return(BadRequest(ex.Message)); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult Create(Ecom_Pedido Ecom_Pedido_) { //return RedirectToAction(nameof(Index)); EcomData_ = new EcomData(StringConnectio); try { if (!ModelState.IsValid) { return(View(Ecom_Pedido_)); } else { EcomData_.Connect(); Ecom_Pedido_ = (Ecom_Pedido)EcomData_.SetObjectConnection(Ecom_Pedido_, DataModel.Pedido); bool result = Ecom_Pedido_.Add(); if (result) { return(RedirectToAction(nameof(Index))); } else { throw new Ecom_Exception(EcomData_.GetLastMessage()); } } } catch (Ecom_Exception ex) { ModelState.AddModelError(string.Empty, string.Format("{0}", ex.Message)); return(View(Ecom_Pedido_)); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult Edit(Ecom_PedidoAjuste Ecom_PedidoAjuste_) { EcomData_ = new EcomData(StringConnectio); try { if (!ModelState.IsValid) { return(View(Ecom_PedidoAjuste_)); } else { EcomData_.Connect(); Ecom_PedidoAjuste_ = (Ecom_PedidoAjuste)EcomData_.SetObjectConnection(Ecom_PedidoAjuste_, DataModel.PedidoAjuste); bool result = Ecom_PedidoAjuste_.Update(); if (result) { return(RedirectToAction("Details", "Pedido", new { Id = Ecom_PedidoAjuste_.Pedido })); } else { throw new Ecom_Exception(EcomData_.GetLastMessage()); } } } catch (Ecom_Exception ex) { ModelState.AddModelError(string.Empty, string.Format("{0}", ex.Message)); return(View(Ecom_PedidoAjuste_)); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }