public void Guardar(EntPelicula ent) { int filas = new DatPelicula().Guardar(ent.Nombre, ent.AnioLanzamiento, ent.Clasificacion.Id, ent.Genero.Id, ent.FechaAlta, ent.Estatus, ent.Sinopsis, ent.Trailer, ent.FotoPortada, ent.FotoMini); if (filas != 1) { throw new ApplicationException("Error al Insertar Pelicula "); } }
public void Actualizar(EntPelicula ent) { int filas = new DatPelicula().Actualizar(ent.Nombre, ent.AnioLanzamiento, ent.Clasificacion.Id, ent.Genero.Id, ent.Estatus, ent.Sinopsis, ent.Trailer, ent.FotoPortada, ent.FotoPortada, ent.Id); if (filas != 1) { throw new ApplicationException("Error al Actualizar Pelicula"); } }
private List<EntPelicula> obj(DataTable dt) { List<EntPelicula> lst = new List<EntPelicula>(); foreach (DataRow dr in dt.Rows) { EntPelicula ent = new EntPelicula(); ent.Id = Convert.ToInt32(dr["PELI_ID"]); ent.Nombre = dr["PELI_NOMB"].ToString(); ent.AnioLanzamiento = Convert.ToDateTime(dr["PELI_ANIO_LANZ"]); ent.Estatus = Convert.ToBoolean(dr["PELI_ESTA"]); ent.Sinopsis = dr["PELI_SINO"].ToString(); ent.Trailer = dr["PELI_TRAI"].ToString(); ent.FotoPortada = dr["PELI_FOTO_PORT"].ToString(); ent.FotoMini = dr["PELI_FOTO_MINI"].ToString(); ent.Genero.Nombre = dr["GENE_NOMB"].ToString(); ent.Clasificacion.Nombre = dr["CLAS_NOMB"].ToString(); lst.Add(ent); } return lst; }