示例#1
0
        public static bool Actualizar(M_Clientes c)
        {
            var result = false;

            try
            {
                var db = new ecomercebdEntities();
                var x  = db.Clientes.SingleOrDefault(k => k.ID == c.ID);

                if (x != null)
                {
                    x.Nombre   = c.Nombre;
                    x.Apellido = c.Apellido;
                    x.Telefono = c.Telefono;
                    x.CorreoE  = c.CorreoE;
                    db.SaveChanges();
                    result = true;
                    return(result);
                }
                else
                {
                    return(result);
                }
            }
            catch (Exception ex)
            {
                return(false);

                throw;
            }
        }
示例#2
0
        public static bool Guardar(M_Clientes c)
        {
            try
            {
                var db = new ecomercebdEntities();
                var x  = ConvertToDBTable(c);

                db.Clientes.Add(x);
                db.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);

                throw;
            }
        }