public static bool Actualizar(M_MetodosPago c) { var result = false; try { var db = new EcomerceEntities(); var x = db.MetodosPago.SingleOrDefault(k => k.ID == c.ID); if (x != null) { x.IDCliente = c.IDCliente; x.Nombre = c.Nombre; x.Empresa = c.Empresa; x.NumTarjeta = c.NumTarjeta; x.CCV = c.CCV; db.SaveChanges(); result = true; return(result); } else { return(result); } } catch (Exception ex) { return(false); throw; } }
public HttpResponseMessage Guardar([FromBody] M_MetodosPago c) { try { if (ValidarAutorizacion()) { var x = MetodosPagoRepositorio.Guardar(c); if (x == false) { return(OkResponse("Hubo un error al recuperar el registro")); } else { return(OkResponse(x)); } } else { return(OkResponse("No tiene acceso")); } } catch (Exception) { return(ErrorResponse("Ha ocurrido un error")); throw; } }
public HttpResponseMessage Actualizar([FromBody] M_MetodosPago a) { try { if (ValidarAutorizacion()) { var x = MetodosPagoRepositorio.Actualizar(a); if (x == false) { return(OkResponse("Hubo un error al tratar de actualizar")); } else { return(OkResponse(x)); } } else { return(OkResponse("No tiene acceso")); } } catch (Exception) { return(ErrorResponse("Ha ocurrido un error")); throw; } }
public static MetodosPago ConvertToDBTable(M_MetodosPago c) { return(new MetodosPago { ID = c.ID, IDCliente = c.IDCliente, Nombre = c.Nombre, Empresa = c.Empresa, NumTarjeta = c.NumTarjeta, CCV = c.CCV }); }
public static bool Guardar(M_MetodosPago c) { try { var db = new EcomerceEntities(); var x = ConvertToDBTable(c); db.MetodosPago.Add(x); db.SaveChanges(); return(true); } catch (Exception ex) { return(false); throw; } }