コード例 #1
0
        public string ActualizarTipo(TipoProducto objeto)
        {
            string respuesta = "";

            try
            {
                db = new ColoresEntities();
                GenericRepository <TipoProducto> Rep = new GenericRepository <TipoProducto>(db);
                Rep.Actualizar(objeto);
                respuesta = "El tipo ha sido actualizado";
            }
            catch (Exception error)
            {
                respuesta = "Error al actualizar categoría" + error.Message;
            }
            return(respuesta);
        }
コード例 #2
0
        public static TipoProducto getByIdStatic(decimal id)
        {
            try
            {
                TipoProducto p = new TipoProducto();
                using (var comun = new Common().modelo)
                {
                    TIPO_PRODUCTO pp = comun.TIPO_PRODUCTO.First(tpp => tpp.TP_ID == id);

                    p.id     = pp.TP_ID;
                    p.nombre = pp.TP_NOMBRE;
                }
                return(p);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #3
0
        public string NuevoTipoProducto(string nombre, int precio, string color, int med, int marca, int cat)
        {
            string       respuesta = "";
            TipoProducto tipo      = new TipoProducto();

            try
            {
                db = new ColoresEntities();
                GenericRepository <TipoProducto> Rep = new GenericRepository <TipoProducto>(db);
                tipo.Nombre      = nombre;
                tipo.Precio      = precio;
                tipo.Color       = color;
                tipo.MedidaId    = med;
                tipo.MarcaId     = marca;
                tipo.CategoriaId = cat;
                Rep.Agregar(tipo);
                respuesta = "Tipo ingresado correctamente";
            }
            catch (Exception error)
            {
                respuesta = "Error al grabar" + error.Message;
            }
            return(respuesta);
        }
コード例 #4
0
 public TipoProductoBLL(TipoProducto nuevo)
 {
     this.Id          = nuevo.ProductoId;
     this.Descripcion = nuevo.Nombre;
 }