/// <exception cref=InstanceNotFoundException">If not exist favorito</exception> public Favorito RemoveFavorito(long usrId, long favoritoId) { int start_index = 0; int count = 20; List <Favorito> favoritos = FavoritoDao.FindByUsrId(usrId, start_index, count); Favorito favorito = FavoritoDao.Find(favoritoId); int numFavo = FavoritoDao.GetNumberByUsrId(usrId); while (numFavo < count) { if (favoritos.Contains(favorito)) { FavoritoDao.Remove(favorito.favoritoId); return(favorito); } else { start_index = start_index + count; count = count + count; favoritos = FavoritoDao.FindByUsrId(usrId, start_index, count); } } throw new InstanceNotFoundException(favorito.favoritoId, "favorito"); }
public int GetNumberOfFavoritosByUsrId(long usrId) { return(FavoritoDao.GetNumberByUsrId(usrId)); }