Example #1
0
        public static bool Modificard(int id, TipoUsuarios tip)
        {
            bool retorno = false;

            try
            {
                using (var db = new SistemaVentasDb())
                {
                    TipoUsuarios t = db.TipoUsuarios.Find(id);
                    t.Detalle = tip.Detalle;

                    db.SaveChanges();
                }
                retorno = true;
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }
Example #2
0
        public static bool Eliminar(int id)
        {
            try
            {
                using (var db = new SistemaVentasDb())
                {
                    TipoUsuarios t = new TipoUsuarios();
                    t = db.TipoUsuarios.Find(id);

                    db.TipoUsuarios.Remove(t);
                    db.SaveChanges();
                    db.Dispose();
                    return(false);
                }
            }
            catch (Exception)
            {
                return(true);

                throw;
            }
        }
Example #3
0
        public static bool Insertars(TipoUsuarios t)
        {
            //  bool retorna = false;

            try
            {
                using (var db = new SistemaVentasDb())
                {
                    db.TipoUsuarios.Add(t);
                    db.SaveChanges();
                    db.Dispose();
                    // retorna= true;
                    return(true);
                }
            }
            catch (Exception)
            {
                return(false);

                throw;
            }

            // return retorna;
        }