public static int GetCantDisLikes(int peliculaID) { if (peliculaID <= 0) { throw new ArgumentException("PeliculaID debe ser mayor a 0"); } LikeTableAdapter adapter = new LikeTableAdapter(); Like_DS.LikeDataTable table = adapter.GetCantDislikes(peliculaID); return(table.Rows.Count); }
public static Like GetLikeByUserPeliculaID(int userID, int peliculaID) { LikeTableAdapter adapter = new LikeTableAdapter(); Like_DS.LikeDataTable table = adapter.GetLikeByUserPeliculaID(userID, peliculaID); if (table.Rows.Count <= 0) { return(null); } Like_DS.LikeRow row = table[0]; Like obj = new Like() { LikeID = row.LikeId, IsLike = row.isLike, UserID = row.UserId, PeliculaID = row.peliculaId, }; return(obj); }